Smarty Forum Index Smarty
The discussions here are for Smarty, a template engine for the PHP programming language.

problem with smarty menu

 
Post new topic   Reply to topic    Smarty Forum Index -> Add-ons
View previous topic :: View next topic  
Author Message
sriramchitta
Smarty Rookie


Joined: 14 Oct 2004
Posts: 14
Location: Hyderabad

PostPosted: Tue Dec 14, 2004 10:04 am    Post subject: problem with smarty menu Reply with quote

hi,

SmartyMenu is not working for me
this is my code i created a object for Smartymenu in my config file and using it.....

the following code doesn't show any ouput.

<?php

include_once("config.inc.php");
global $gSmarty,$gSmartyMenu,$SITE_URL;

/* Sub Menu for Masters */

$gSmartyMenu->menuInit($sub_menu);

$gSmartyMenu->initItem($item);
$gSmartyMenu->setItemText($item,"Employee Salary");
$gSmartyMenu->setItemLink($item,"$SITE_URL/index.php?qs=".
base64_encode("act=48&t=".time()));
$gSmartyMenu->setItemClass($item, 'subnav');
$gSmartyMenu->addMenuItem($sub_menu, $item);


/* Main Menu for Masters */

$gSmartyMenu->initMenu($menu);

$gSmartyMenu->initItem($item);
$gSmartyMenu->setItemText($item,"Masters");

$gSmartyMenu->setItemLink($item,"$SITE_URL/index.php?qs=".
base64_encode("act=65&t=".time()));

$gSmartyMenu->setItemClass($item, 'topnav');

$gSmartyMenu->setItemSubmenu($item, $sub_menu);

$gSmartyMenu->addMenuItem($menu, $item);

//print_r($menu);

$gSmarty->assign("menu",$menu);
?>

Template
<head>
{menu_init css="$CSS_REF/outline_h.css"}
</head>
{menu data=$menu}

I need this working please help .....

thanks,

Sriram.
Back to top
View user's profile Send private message Visit poster's website MSN Messenger
mohrt
Administrator


Joined: 16 Apr 2003
Posts: 7364
Location: Lincoln Nebraska, USA

PostPosted: Tue Dec 14, 2004 2:53 pm    Post subject: Reply with quote

What does print_r($menu) show? does your javascript console give any errors? What browser?
Back to top
View user's profile Send private message Visit poster's website
mohrt
Administrator


Joined: 16 Apr 2003
Posts: 7364
Location: Lincoln Nebraska, USA

PostPosted: Tue Dec 14, 2004 3:00 pm    Post subject: Reply with quote

Maybe start with a very simple array:
Code:

$menu = array(
        array(
            'text' => 'Yahoo',
            'link' => 'http://www.yahoo.com',
            'class' => 'topnav'
        ),
        array(
            'text' => 'Google',
            'link' => 'http://www.google.com',
            'class' => 'topnav'
        ),
    );


Get that working first, then try yours again.

Also, there shouldn't be a reason to create in instance of SmartyMenu, you should probably use it statically as it was intended.
Back to top
View user's profile Send private message Visit poster's website
sriramchitta
Smarty Rookie


Joined: 14 Oct 2004
Posts: 14
Location: Hyderabad

PostPosted: Tue Dec 14, 2004 3:00 pm    Post subject: smarty menu problem Reply with quote

i commented it amd no javascript errors. i also tried to print the $menu in samrty template ({php} print_r($menu){/php}) and nothing is displayed.

What could be the problem???

can you send me a working copy of the script if you have one

thanks

Sriram
Back to top
View user's profile Send private message Visit poster's website MSN Messenger
mohrt
Administrator


Joined: 16 Apr 2003
Posts: 7364
Location: Lincoln Nebraska, USA

PostPosted: Tue Dec 14, 2004 3:03 pm    Post subject: Reply with quote

The print_r($menu) you have in your PHP code commented out, that is where you execute it.

The smarty menu demo shows a "working copy", try to get that working first.
Back to top
View user's profile Send private message Visit poster's website
sriramchitta
Smarty Rookie


Joined: 14 Oct 2004
Posts: 14
Location: Hyderabad

PostPosted: Tue Dec 14, 2004 3:15 pm    Post subject: hello Mr.Monte Reply with quote

i mean a sample script that you have. and the source which i have is downloaded from that site and tried to execute in the way its mentioned in the site.

what version of smarty do we need for smarty menu. i have 2.3.X is this sufficient for it

i am sorry if i hurt in my previous message. you sounded very angry in your reply
Thanks
Sriram
Back to top
View user's profile Send private message Visit poster's website MSN Messenger
mohrt
Administrator


Joined: 16 Apr 2003
Posts: 7364
Location: Lincoln Nebraska, USA

PostPosted: Tue Dec 14, 2004 3:32 pm    Post subject: Reply with quote

no anger here...

The online demo shows all of the source for a working demonstration, so I'm not sure what you want me to send you.
Back to top
View user's profile Send private message Visit poster's website
sriramchitta
Smarty Rookie


Joined: 14 Oct 2004
Posts: 14
Location: Hyderabad

PostPosted: Tue Dec 14, 2004 3:34 pm    Post subject: smarty menu Reply with quote

which version of smarty source do we need

sriram
Back to top
View user's profile Send private message Visit poster's website MSN Messenger
mohrt
Administrator


Joined: 16 Apr 2003
Posts: 7364
Location: Lincoln Nebraska, USA

PostPosted: Tue Dec 14, 2004 4:00 pm    Post subject: Reply with quote

I've only tested it on the lastest release, although nothing comes to mind why it wouldn't work on older versions.

I'd suggest follow the installation instructions to the tee, make a simple single-level menu and get that working first.
Back to top
View user's profile Send private message Visit poster's website
sriramchitta
Smarty Rookie


Joined: 14 Oct 2004
Posts: 14
Location: Hyderabad

PostPosted: Tue Dec 14, 2004 4:22 pm    Post subject: hello Reply with quote

i tried it but still didn't worked.i had the same kind of problem with smarty paginate where i was using 3.0.x version of smarty source and it didn't worked util i upgraded it. so i will also try it with the latest version of smarty. I will contact you again if i there a problem still

thanks

Sriram.
Back to top
View user's profile Send private message Visit poster's website MSN Messenger
sriramchitta
Smarty Rookie


Joined: 14 Oct 2004
Posts: 14
Location: Hyderabad

PostPosted: Tue Dec 14, 2004 5:17 pm    Post subject: thank you Reply with quote

Hello Mr.Monte,

It started worked working with new source of smarty.

THnak you for your help

Sriram.
Back to top
View user's profile Send private message Visit poster's website MSN Messenger
Display posts from previous:   
Post new topic   Reply to topic    Smarty Forum Index -> Add-ons All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB © 2001, 2005 phpBB Group
Protected by Anti-Spam ACP