1
ladon
Smarty & PHP
  • 2005/5/29 15:39

  • ladon

  • Quite a regular

  • Posts: 284

  • Since: 2003/10/31


I’m probably just trying to make things harder than necessary, but here’s what I want to achieve: I want to assign a smarty variable that holds the groupid of an user. I need it to be global because it will be used in a dropdown menu which is always displayed. Currently I add extra menus or menuoptions by using these smarty variables: <{if $xoops_isadmin}> and <{if $xoops_isuser}>.

Now I want a variable that will hold groupid so I can use it like this: <{if $groupid == 4}> display newsposters/approvers menu <{/if}>.

I actually thought I could achieve this without hacking, using the smarty php tags. I wanted to create something like this:
Quote:

<{php}>
GLOBAL $xoopsDB;
$userid = $xoopsUser->getVar('uid');
$thegroupid = "SELECT groupid FROM ".$xoopsDB->prefix("groups_users_link")." WHERE uid = userid";
$GLOBALS['xoopsTpl']->assign('group', $sql);
<{/php}>

This is just an impression because I know it can’t work like this. Someone who knows how I can achieve this?

2
ladon
Re: Smarty & PHP
  • 2005/5/29 21:22

  • ladon

  • Quite a regular

  • Posts: 284

  • Since: 2003/10/31


The example posted above is to be used in the main theme file.

A totally different approach to reaching my goal would also be greatly appreciated Oops, is this a bump

3
ladon
Re: Smarty & PHP
  • 2005/6/1 19:42

  • ladon

  • Quite a regular

  • Posts: 284

  • Since: 2003/10/31


Hoping that someone might notice this topic, small topickick again.

4
Dave_L
Re: Smarty & PHP
  • 2005/6/1 19:57

  • Dave_L

  • XOOPS is my life!

  • Posts: 2277

  • Since: 2003/11/7



5
ladon
Re: Smarty & PHP
  • 2005/6/1 20:12

  • ladon

  • Quite a regular

  • Posts: 284

  • Since: 2003/10/31


Thank you, I'm sure that will get me somewhere

Login

Who's Online

156 user(s) are online (111 user(s) are browsing Support Forums)


Members: 0


Guests: 156


more...

Donat-O-Meter

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

Latest GitHub Commits