Post by HTMLCSSNoob » Sat Oct 16, 2010 6:56 pm

Does anyone know how to make 1 login/logout link that changes depending on whether the customer is logged in or logged out?

I want to move the horizontal navigation menu to a Simple HTML module on the left hand sidebar, but not sure how to move the login/logout button. I'm attaching a picture to give an idea of what i'm trying to do...

Attachments

Screen shot 2010-10-16 at 5.33.54 PM.png

Screen shot 2010-10-16 at 5.33.54 PM.png (32.15 KiB) Viewed 4797 times

Last edited by i2Paq on Sat Oct 16, 2010 7:14 pm, edited 1 time in total.
Reason: Topic moved

Active Member

Posts

Joined
Fri Aug 20, 2010 7:53 am

Post by qahar » Sat Oct 16, 2010 7:46 pm

on default2 i use something like this:

Code: Select all

		<?php if (!$logged) { ?>
		<a class="tr_login" href="<?php echo str_replace('&', '&', $login); ?>" title="<?php echo $text_login; ?>"><?php echo $text_login; ?></a>
		<?php } else { ?>
		<a class="tr_logout" href="<?php echo str_replace('&', '&', $logout); ?>" title="<?php echo $text_logout; ?>"><?php echo $text_logout; ?></a>
		<?php } ?>
but not tested yet on module

User avatar
Expert Member

Posts

Joined
Tue Jun 29, 2010 10:24 pm
Location - Indonesia

Post by HTMLCSSNoob » Sun Oct 17, 2010 12:37 am

qahar wrote:on default2 i use something like this:

Code: Select all

		<?php if (!$logged) { ?>
		<a class="tr_login" href="<?php echo str_replace('&', '&', $login); ?>" title="<?php echo $text_login; ?>"><?php echo $text_login; ?></a>
		<?php } else { ?>
		<a class="tr_logout" href="<?php echo str_replace('&', '&', $logout); ?>" title="<?php echo $text_logout; ?>"><?php echo $text_logout; ?></a>
		<?php } ?>
but not tested yet on module
Hey, thanks for that qahar. One question though, were would I try out your code above? What folder and file?

Active Member

Posts

Joined
Fri Aug 20, 2010 7:53 am

Post by jones » Sun Oct 17, 2010 8:20 am

in default theme that located at header.tpl and you can put it at your Main Menu .tpl file, i assume you place Main Menu Module at theme\YOUR_THEME\template\module\

Active Member

Posts

Joined
Tue Aug 24, 2010 1:05 pm

Post by HTMLCSSNoob » Mon Oct 18, 2010 10:08 pm

Hmm, thanks for the help guys, but unfortunately I can't paste php code in the html module (at least not anyway I know how).

Actually I want to move the whole horizontal navigation menu over to the left hand column. Have to play around with it a bit and see if I can figure it out. ???

Active Member

Posts

Joined
Fri Aug 20, 2010 7:53 am

Post by jones » Tue Oct 19, 2010 12:08 pm

so let me see the codes of your Main Menu .tpl, just put it here and let me know where do you place your Main Menu .tpl file?

header.tpl located at
catalog\view\theme\YOUR_THEME\template\common\

Active Member

Posts

Joined
Tue Aug 24, 2010 1:05 pm

Post by HTMLCSSNoob » Tue Oct 19, 2010 4:05 pm

jones wrote:so let me see the codes of your Main Menu .tpl, just put it here and let me know where do you place your Main Menu .tpl file?

header.tpl located at
catalog\view\theme\YOUR_THEME\template\common\
Thanks jones,

My Main Menu is just a Simple HTML module. I got it from http://www.kreasimote.com/component/con ... ncart.html.

I put it at theme\YOUR_THEME\template\module\.

The code for the .tpl file is below:

Code: Select all

<div class="box">
  <div class="top">
	<?php
	  if($title) { ?>	
		<img src="catalog/view/theme/default/image/brands.png" alt="" /><?php echo $title; ?>
	<?php
	} ?>
  </div>
  <div class="middle" style="text-align: left;">
    <?php echo $code; ?>
  </div>
  <div class="bottom">&nbsp;</div>
</div>
I wanted to move my entire horizontal navigation menu into the module, but haven't figured out how to do it yet.... ???

Active Member

Posts

Joined
Fri Aug 20, 2010 7:53 am

Post by jones » Tue Oct 19, 2010 8:04 pm

I think you already know the answered...

come on friend, don't waste your time :laugh:
then

Code: Select all

<?php echo $code; ?>
figured from admin module, right? so mean you able to input html code then output as html decode, but it can't accepted special chars of php without encode to ascii / numeric chars, it's hard to explain

at the end your module can't handle php code, so impossible you will run the php conditions

i see you were answer at http://forum.opencart.com/viewtopic.php?f=113&t=6864 (itu masih berhubungan lagi)

am i missing?

Active Member

Posts

Joined
Tue Aug 24, 2010 1:05 pm

Post by ifyouseek » Wed Oct 20, 2010 12:18 pm

If you copy the html from your mymodule in admin, then paste it into the mymodules .tpl file. Then replacing the login/logout links with the php code should work.

Code: Select all

<div class="box">
  <div class="top">
   <?php
     if($title) { ?>   
      <img src="catalog/view/theme/default/image/brands.png" alt="" /><?php echo $title; ?>
   <?php
   } ?>
  </div>
  <div class="middle" style="text-align: left;">

*****INSERT HTML & PHP HERE****

    <?php echo $code; ?>
</div>
  <div class="bottom">&nbsp;</div>
</div>

Active Member

Posts

Joined
Thu May 06, 2010 4:40 pm

Post by jones » Thu Oct 21, 2010 1:29 pm

Yea, it should work by inserting from .tpl file but not from form editor at admin module area...

and then if you do that, you need to tell the definition of if (!$logged), $text_login, $text_logout at your e.g. mymodule.php

Active Member

Posts

Joined
Tue Aug 24, 2010 1:05 pm

Post by jcooke » Fri Jun 10, 2011 6:52 am

Thanks for the script you gave earlier. My question is, how do you give this script a specific color?

<?php if (!$logged) { ?>
<a class="tr_login" href="<?php echo str_replace('&', '&', $login); ?>" title="<?php echo $text_login; ?>"><?php echo $text_login; ?></a>
<?php } else { ?>
<a class="tr_logout" href="<?php echo str_replace('&', '&', $logout); ?>" title="<?php echo $text_logout; ?>"><?php echo $text_logout; ?></a>
<?php } ?>


here is what I have now

<td width="150" align="left"><b><font color="#a6ee53" size="2">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
<?php if (!$logged) { ?>
<a class="tr_login" href="<?php echo str_replace('&', '&', $login); ?>" title="<?php echo $text_login; ?>"><?php echo $text_login; ?><span style="text-decoration: none"></span></b></a>
<?php } else { ?>
<a class="tr_logout" href="<?php echo str_replace('&', '&', $logout); ?>" title="<?php echo $text_logout; ?>"><?php echo $text_logout; ?><span style="text-decoration: none"></span></font></font></b></a>
<?php } ?>
</td>

New member

Posts

Joined
Wed Jun 01, 2011 1:07 am

Post by ifyouseek » Mon Jun 13, 2011 6:30 am

Try that -

Code: Select all

<span style="text-align: left; color: #a6ee53; font-size: 14px; font-weight: bold;">

<?php if (!$logged) { ?>
<a class="tr_login" href="<?php echo str_replace('&', '&', $login); ?>" title="<?php echo $text_login; ?>"><?php echo $text_login; ?></a>
<?php } else { ?>
<a class="tr_logout" href="<?php echo str_replace('&', '&', $logout); ?>" title="<?php echo $text_logout; ?>"><?php echo $text_logout; ?></a>
<?php } ?>

</span>

Active Member

Posts

Joined
Thu May 06, 2010 4:40 pm

Post by jcooke » Mon Jun 13, 2011 8:15 pm

Thanks for the reply. I didn't even think to use a span.

New member

Posts

Joined
Wed Jun 01, 2011 1:07 am

Post by emotioneu » Tue Nov 15, 2011 8:25 pm

i'm sorry for the "holy thread resurrection - batman!" - but i do need something very similar to what qahar first answered, but for 1.5.1.3 - default.

to me it seems as in the header.tpl neither $login nor $text_login seem to be available (as so for logout & logout_text)

could someone point me into the right direction?

thanks,

emo

User avatar
Newbie

Posts

Joined
Thu Oct 20, 2011 7:12 pm

Post by unetic » Wed Jan 18, 2012 10:50 am

you could always just use a direct link,
<a href="<?php echo HTTP_SERVER . 'index.php?route=account/logout'; ?>">LOGOUT</a>
as i don't believe the login/logout location changes.

Mitchell Bray
http://www.echoedlight.com/

Newbie

Posts

Joined
Wed Jun 15, 2011 5:33 pm
Location - Australia
Who is online

Users browsing this forum: No registered users and 10 guests