View Full Version : Parsing variables in link question
Boofo
03-11-2011, 03:04 PM
Can someone please tell me how you get the raw variables to parse in the link that is an option in a product? Here is what I have in the template:
<vb:if condition="$vbulletin->options['boofo_additional_link_1']">
<li><a href="http://{vb:raw vboptions.boofo_additional_link_1}" target="_blank">{vb:raw vboptions.boofo_additional_link_1_title}</a></li>
</vb:if>
And the link I have set for the boofo_additional_link_1 option:
{vb:raw vboptions.bburl}/search.php?{vb:raw session.sessionurl}do=finduser&userid={vb:raw bbuserinfo.userid}&contenttype=vBForum_Post&showposts=1
The raw variables don't get parsed when viewing the link in the menu.
Lynne
03-11-2011, 03:33 PM
Try using php in the option - $vbulletin->options['bburl'] and $vbulletin->session->vars['sessionurl'] etc.
Boofo
03-11-2011, 03:53 PM
I tried it like this and they don't get parsed when I add it to the setting:
$vbulletin->options['bburl']/search.php?$vbulletin->session->vars['sessionurl']do=finduser&userid=$vbulletin->userinfo['userid']&contenttype=vBForum_Post&showposts=1
If I add the raw variable line directly into the template, then it parses fine. Just not through the setting.
Lynne
03-11-2011, 04:05 PM
Try just spitting out {vb:raw vboptions.boofo_additional_link_1} in the template. What do you get then?
Boofo
03-11-2011, 04:12 PM
{vb:raw vboptions.boofo_additional_link_1} is what I have in the template. The link is in the boofo_additional_link_1 setting line. Or am I missing what you are meaning?
Lynne
03-11-2011, 04:40 PM
I mean, just spit it out. Not in the <a href..> tag. Just see what it is carrying to the template.
Boofo
03-11-2011, 05:06 PM
Ok, with the raw variables, this is what I get when I do a print_r in the template:
print_r (http://www.mysitehere.com/forums/search.php?do=finduser&userid=1&contenttype=vBForum_Post&showposts=1);
It parses fine directly in the template. Only when I do it via the setting, it doesn't.
I changed my site to mysitehere, for reasons you already know. ;)
Lynne
03-11-2011, 06:04 PM
What I am saying it just put {vb:raw vboptions.boofo_additional_link_1} directly in the template. What exactly do you get then? What is printing out in the template when you do that? And what do you have in the options exactly right now?
Boofo
03-11-2011, 06:38 PM
I get this when I do that:
{vb:raw vboptions.bburl}/search.php?{vb:raw session.sessionurl}do=finduser&userid={vb:raw bbuserinfo.userid}&contenttype=vBForum_Post&showposts=1
That is the same exact code I have in the options setting. It does the same thing if I use $vbulletin->options.
If I do it like this in the template, then it parses fine.
<li><a href="{vb:raw vboptions.bburl}/search.php?{vb:raw session.sessionurl}do=finduser&userid={vb:raw bbuserinfo.userid}&contenttype=vBForum_Post&showposts=1" target="_blank">{vb:raw vboptions.boofo_additional_link_5_title}</a></li>
It just doesn't like going from the setting to the variable in the template for some reason.
Lynne
03-11-2011, 09:39 PM
OK, so you need to do something to actually parse the options setting. Have you tried changing the Data Validate Type for the option? What type is it currently?
Boofo
03-11-2011, 10:48 PM
It is set as free right now.
Lynne
03-11-2011, 11:36 PM
You know, I really don't know if I've seen any other option that includes the use of variables like that. I am guessing you may need to do something to get it to parse the php in it, but I'm honestly not sure exactly what.
Boofo
03-11-2011, 11:52 PM
What is strange is that I have other links in the template that have those variables in them that parse just fine. Something is getting lost between the setting and the template. It's got me puzzled.
vBulletin® v3.8.12 by vBS, Copyright ©2000-2024, vBulletin Solutions Inc.