Smarty Forum Index Smarty
WARNING: All discussion is moving to https://reddit.com/r/smarty, please go there! This forum will be closing soon.

how do I get Milonic JS Menu to accept Smarty variables?

 
This forum is locked: you cannot post, reply to, or edit topics.   This topic is locked: you cannot edit posts or make replies.    Smarty Forum Index -> General
View previous topic :: View next topic  
Author Message
zoldos
Smarty Rookie


Joined: 06 Aug 2013
Posts: 8

PostPosted: Sun Nov 24, 2013 2:40 am    Post subject: how do I get Milonic JS Menu to accept Smarty variables? Reply with quote

I have a Javascript menu from Milonic. It uses three JS files to display the menu as follows:

Code:
<script type="text/javascript" src="./milonic_src.js"></script>   
<script type="text/javascript" src="./mmenudom.js"></script>
<script type="text/javascript" src="./menu_data.php"></script>


menu_data.php is normally menu_data.js but I was told by their support that I can change it to PHP. The Smarty variable I want to use is:

Code:
{$url->url_create('profile',$user->user_info.user_username)}
(I'm using Social Engine 3.13) but the menu simply echoes this literally in the browser. I also tried removing the { } and using "<", ">" but it still didn't work. I'm thinking I have to somehow tell the menu to initiate Smarty before it will work but I don't know how to do this.

Can anyone offer any ideas or help? Thanks!
Back to top
View user's profile Send private message
U.Tews
Administrator


Joined: 22 Nov 2006
Posts: 5068
Location: Hamburg / Germany

PostPosted: Sun Nov 24, 2013 2:11 pm    Post subject: Reply with quote

Your javascript files will be included by your browser on the client.
They don't run through Smarty the server. The only way would be that you pass Smarty variables in the template files as parameter when the JS functions get called.
Back to top
View user's profile Send private message
zoldos
Smarty Rookie


Joined: 06 Aug 2013
Posts: 8

PostPosted: Sun Nov 24, 2013 10:56 pm    Post subject: Reply with quote

U.Tews wrote:
Your javascript files will be included by your browser on the client.
They don't run through Smarty the server. The only way would be that you pass Smarty variables in the template files as parameter when the JS functions get called.

How can I do this? I know I can "call" JS functions from inside the menu. Can I somehow create a function that captures the username and creates the correct URL then call this from the menu?
Back to top
View user's profile Send private message
zoldos
Smarty Rookie


Joined: 06 Aug 2013
Posts: 8

PostPosted: Tue Nov 26, 2013 5:07 am    Post subject: Reply with quote

Figured it out by switching to a list style menu where each menu item is plain HTML. Thanks tho!
Back to top
View user's profile Send private message
Display posts from previous:   
This forum is locked: you cannot post, reply to, or edit topics.   This topic is locked: you cannot edit posts or make replies.    Smarty Forum Index -> General 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