Gossamer Forum
Home : Products : Gossamer Links : Development, Plugins and Globals :

How to nest template tags?

Quote Reply
How to nest template tags?
Running into problems nesting template tags.

Trying to run the following

Code:
<%LWP::Simple::get('http://www.braydigital.com/videos/Detailed/movie.php?movie=<%video%>')%>

How would I go about achieving what I'm trying to achieve (executing the php script on a dynamic page. the script needs to be passed a variable which is stored in the links database...)
Cheers,
Michael Bray
Quote Reply
Re: [Michael_Bray] How to nest template tags? In reply to
Try a simple global:

get_url_value
Code:
sub {
use LWP::Simple;
return get($_[0]);
}

Call with:

Code:
<%set get_url = "http://www.braydigital.com/videos/Detailed/movie.php?movie="%>
<%set get_url .= $video%>
<%get_url_value($get_url)%>

That should do it :)

Cheers

Andy (mod)
andy@ultranerds.co.uk
Want to give me something back for my help? Please see my Amazon Wish List
GLinks ULTRA Package | GLinks ULTRA Package PRO
Links SQL Plugins | Website Design and SEO | UltraNerds | ULTRAGLobals Plugin | Pre-Made Template Sets | FREE GLinks Plugins!
Quote Reply
Re: [Michael_Bray] How to nest template tags? In reply to
Inside a string, the syntax is to use $, you also need to switch your quotes to double quotes ("). So:
Code:
<%LWP::Simple::get("http://www.braydigital.com/videos/Detailed/movie.php?movie=$video")%>

However, you should be url escaping the video argument, so you should do something like that Andy says:
Code:
<%set url = 'http://www.braydigital.com/videos/Detailed/movie.php?movie='%>
<%if video%>
<%set url .= escape_url($video)%>
<%endif%>
<%LWP::Simple::get($url)%>

Adrian
Quote Reply
Re: [Andy] How to nest template tags? In reply to
Thanks guys, got it working. That plugin I got off you Andy worked really work. I can create two categories

Paid Videos and Free Videos and have all the subcategories below that. Lets me keep it all nice and organised while still being able to charge people to view the videos that I want to.

Thanks guys!
Cheers,
Michael Bray
Quote Reply
Re: [Michael_Bray] How to nest template tags? In reply to
Hi,

Glad to hear it works well :)

Cheers

Andy (mod)
andy@ultranerds.co.uk
Want to give me something back for my help? Please see my Amazon Wish List
GLinks ULTRA Package | GLinks ULTRA Package PRO
Links SQL Plugins | Website Design and SEO | UltraNerds | ULTRAGLobals Plugin | Pre-Made Template Sets | FREE GLinks Plugins!