close ad
 
Important WebAssist Announcement
open ad
View Menu

Technical Support Forums

Free, outstanding support from WebAssist and your colleagues

rating

update Main.dwt.php links to always show cart

Thread began 3/06/2010 1:56 pm by lucyland | Last modified 3/08/2010 3:07 pm by Jason Byrnes | 6948 views | 1 replies |

lucyland

update Main.dwt.php links to always show cart

Hi,

I'd like to adapt the links in the Main.dwt.php template to do a couple of different things and am not proficient enough in php to figure it out.

First, I'd like the "View Cart" link to always display. And second, I'd like to show only "Login" with an option to register if one doesn't have an account. I might change the link to say "Your Account" instead of Login.

Here's the code I assume needs to be updated (I've added a cart icon):

<div class="links">
<?php
$WA_localRoot = "".$WAGLOBAL_localRoot."";
$WA_remoteRoot = "".$WAGLOBAL_remoteRoot."";
$WA_curURL = strtolower((isset($_SERVER["PHP_SELF"]))?$_SERVER["PHP_SELF"]:"");
$assumedRoot = $WA_remoteRoot;
if ((strpos($WA_curURL,strtolower($WA_localRoot)) !== false && strpos($WA_curURL,strtolower($WA_localRoot)) == 0) && (strlen($WA_localRoot) >= strlen($WA_remoteRoot) || strpos($WA_curURL,strtolower($WA_localRoot)) === 0)) {
$assumedRoot = $WA_localRoot;
}
?>
<?php if(isset($_SESSION["UserID"])) { ?>
<a href="<?php echo($assumedRoot); ?>users_Profile.php">My Profile</a>
<a href="<?php echo($assumedRoot); ?>users_LogOut.php">Log out</a>
<?php } else { ?>
<a href="<?php echo($assumedRoot); ?>users_LogIn.php">Login</a>
<a href="<?php echo($assumedRoot); ?>users_Registration.php">Register</a>
<?php } ?>
<?php if(isset($_SESSION["WA_Store_Cart_Items"]) && $_SESSION["WA_Store_Cart_Items"] != "") { ?>
<a href="<?php echo($assumedRoot); ?>cart.php">View Cart <img src="../Images/view-cart.png" alt="view cart" width="24" height="18" border="0" align="absmiddle"/></a>
<?php } ?>
</div>

I know I'll have to update the users_Login.php page, too.

Thanks!

Sign in to reply to this post

Jason ByrnesWebAssist

for the cart to always display, change:

php:
<?php if(isset($_SESSION["WA_Store_Cart_Items"]) && $_SESSION["WA_Store_Cart_Items"] != "") { ?>

<a href="<?php echo($assumedRoot); ?>cart.php">View Cart <img  src="../Images/view-cart.png" alt="view cart" width="24" height="18" border="0" align="absmiddle"/></a>
<?php ?>




to:

php:
<a href="<?php echo($assumedRoot); ?>cart.php">View Cart <img  src="../Images/view-cart.png" alt="view cart" width="24" height="18" border="0" align="absmiddle"/></a>





to only show the login and register links, change:

php:
<?php if(isset($_SESSION["UserID"])) { ?>

<a href="<?php echo($assumedRoot); ?>users_Profile.php">My Profile</a>
<a href="<?php echo($assumedRoot); ?>users_LogOut.php">Log out</a>
<?php } else { ?>
<a href="<?php echo($assumedRoot); ?>users_LogIn.php">Login</a>
<a href="<?php echo($assumedRoot); ?>users_Registration.php">Register</a>
<?php ?>





to:

php:
<a href="<?php echo($assumedRoot); ?>users_LogIn.php">Login</a>

<a href="<?php echo($assumedRoot); ?>users_Registration.php">Register</a>
Sign in to reply to this post

Build websites with a little help from your friends

Your friends over here at WebAssist! These Dreamweaver extensions will assist you in building unlimited, custom websites.

Build websites from already-built web applications

These out-of-the-box solutions provide you proven, tested applications that can be up and running now.  Build a store, a gallery, or a web-based email solution.

Want your website pre-built and hosted?

Close Windowclose

Rate your experience or provide feedback on this page

Account or customer service questions?
Please user our contact form.

Need technical support?
Please visit support to ask a question

Content

rating

Layout

rating

Ease of use

rating

security code refresh image

We do not respond to comments submitted from this page directly, but we do read and analyze any feedback and will use it to help make your experience better in the future.

Close Windowclose

We were unable to retrieve the attached file

Close Windowclose

Attach and remove files

add attachmentAdd attachment
Close Windowclose

Enter the URL you would like to link to in your post

Close Windowclose

This is how you use right click RTF editing

Enable right click RTF editing option allows you to add html markup into your tutorial such as images, bulleted lists, files and more...

-- click to close --

Uploading file...