1
kalamata
Smarty variables in conditional statements
  • 2007/6/27 11:01

  • kalamata

  • Not too shy to talk

  • Posts: 121

  • Since: 2005/3/3 1


Dear All,

I want to display a link to the main menu of my XOOPS site, but only to registered users. When I wanted it only to be shown to admin users the following conditional in the relevant template of the system module would be sufficient: <{if $xoops_isadmin}> ... <{/if}>. If I change it to <{if $xoops_isuser}>...<{/if}> to check if a user is logged on, it will not work. Any ideas on what I am doing wrong (or overlooking) here?

I look forward to hearing from you soon.

Many Thanks,
George

2
stefan88
Re: Smarty variables in conditional statements
  • 2007/6/27 15:48

  • stefan88

  • Community Support Member

  • Posts: 1086

  • Since: 2004/9/20


Hi,

if you edited the template file, did you updated the coreponding module?

did you clean the template cache?

I use this in my mainmenu block and it is working:

<{if !$xoops_isuser}>
      <
a href="<{$xoops_url}>/user.php"><{$smarty.const._LOGIN}>a>
      <
br />
      <
a href="<{$xoops_url}>/user.php#lost"><{$smarty.const._MB_SYSTEM_LPASS}>a>
      <
br />
      <{/if}>
..

3
kalamata
Re: Smarty variables in conditional statements
  • 2007/6/27 16:23

  • kalamata

  • Not too shy to talk

  • Posts: 121

  • Since: 2005/3/3 1


Quote:

stefan88 wrote:
Hi,

if you edited the template file, did you updated the coreponding module?

did you clean the template cache?

I use this in my mainmenu block and it is working:

<{if !$xoops_isuser}>
      <
a href="<{$xoops_url}>/user.php"><{$smarty.const._LOGIN}>a>
      <
br />
      <
a href="<{$xoops_url}>/user.php#lost"><{$smarty.const._MB_SYSTEM_LPASS}>a>
      <
br />
      <{/if}>

I made the changed through the templates section of the admin menu, do you still need to update the module? I cleaned templates_c as well and it is still not working. My code basically looks like the following (within the for loop that returns all non-hidden installed modules):
<{if $xoops_isuser }>
a href="<{$xoops_url}>/user.php">Login
<{/if}>
but it does not work.

George

4
stefan88
Re: Smarty variables in conditional statements
  • 2007/6/27 21:02

  • stefan88

  • Community Support Member

  • Posts: 1086

  • Since: 2004/9/20


Hi

Quote:
I made the changed through the templates section of the admin menu, do you still need to update the module?


in that case - no.

Quote:
My code basically looks like the following (within the for loop that returns all non-hidden installed modules):
:
<{if $xoops_isuser }>
a href="<{$xoops_url}>/user.php">Logina>
<{/if}>


here you are missing an opening < on "a" tag. And the code should be outside the loop ... (Also why you need a link to login for loged user?)

Now I'm counting some options:

- did you set your new template set to be used as default in admin -> preferences -> general?

- do you have update templates from file to "off" in the same place?


An option for you could be to edit the template file with the changes you want and update the module ...

..

5
kalamata
Re: Smarty variables in conditional statements
  • 2007/7/3 11:40

  • kalamata

  • Not too shy to talk

  • Posts: 121

  • Since: 2005/3/3 1


My fault - I have not given registered users access to the module (it took three hours to understand that ).

As for the Login link, I just used it as an example - do not need it in this case.

Many thanks for your help.

George

Login

Who's Online

274 user(s) are online (175 user(s) are browsing Support Forums)


Members: 0


Guests: 274


more...

Donat-O-Meter

Stats
Goal: $100.00
Due Date: Nov 30
Gross Amount: $0.00
Net Balance: $0.00
Left to go: $100.00
Make donations with PayPal!

Latest GitHub Commits