Gossamer Forum
Home : Products : Gossamer Links : Discussions :

pass variable and parse with php

Quote Reply
pass variable and parse with php
How can I pass variable and parse it on other php page?

I have variable <%city%> which will show on my template page fine.

Now I want to use my php page which will draw a image based on "city" variable.

http://www.test123.com/...map.php?city=toronto

above works fine. Now How do I include this on my template pages?

<%include http://www.test123.com/...city=<%city%>%>

Obviously above does not work, but maybe it shows what I am after Tongue

Thanks (Just noticed there is no discussion going on with dbman sql, so posted here)
Quote Reply
Re: [Suomi] pass variable and parse with php In reply to
I use something similar but in gossamer mail:

<%set html = GT::WWW::get ('http://somedomain.com/cgi-bin/displayw.pl')%>
<%unescape_html html%>

Relative url's would however break the images :/ at least that's what i found, unless i missed something obvious. Perhaps you could try something similar and see if it works for you.

HyTC

Thanks
HyTC
==================================
Mail Me If Contacting Privately Is That Necessary.
==================================
Quote Reply
Re: [HyperTherm] pass variable and parse with php In reply to
I assume this will show the whole page, as I wanted, but how could I add variable <%city%> in the url?

Code:

<%set html = GT::WWW::get ('http://somedomain.com/cgi-bin/displayw.pl?<%city%>')%>
<%unescape_html html%>


does not work.... obviously Unsure

I am trying to pull data from other php script, based on search variable <%city%> .
Thanks
Quote Reply
Re: [Suomi] pass variable and parse with php In reply to
Try;

<%set html = GT::WWW::get ("http://somedomain.com/cgi-bin/displayw.pl?$city")%>

Hope that helps.

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: [Suomi] pass variable and parse with php In reply to
Just tried including php?query string and it worked as follows:

<%set sitereport = LWP::Simple::get('http://www.siteuptime.com/statistics.php?Id=xxxxxx&UserId=12345')%>
<%unescape_html sitereport%>

And it did work. Since it works correctly, i presume the above is correct. Not too sure on the breaking of relative paths.

HyTC

Thanks
HyTC
==================================
Mail Me If Contacting Privately Is That Necessary.
==================================
Quote Reply
Re: [Andy] pass variable and parse with php In reply to
"$city" did not work Shocked it just displays "city" and not the actual variable.

Any other suggestions?

Last edited by:

Suomi: Dec 4, 2004, 1:32 PM
Quote Reply
Re: [Suomi] pass variable and parse with php In reply to
GT::Template doesn't currently support variable interpolation inside strings - for now, try:

<%set url = 'http://somedomain.com/cgi-bin/displayw.pl?'%>
<%set url .= $city%>
<%set html = GT::WWW::get($url)%>

Jason Rhinelander
Gossamer Threads
jason@gossamer-threads.com
Quote Reply
Re: [Jagerman] pass variable and parse with php In reply to
Nice suggestion, unfortunately it did not work.

Gets us in the right direction tough Angelic

I tried this:

Code:

set url = 'www.domain.com/cgi-bin/?'
set url2 = 'this=that'
set urlcombo = $url.$url2
<%urlcombo%>


It does not display <%urlcombo%> at all, which should be www.domain.com/cgi-bin/?this=that

How do i combine url and url2 to display above?

UPDATE:
Just found this:
Combine global
sub {
return join "", @_
};

and then this:

<%set url = 'http://www.domain.com/='%>
<%set url2 = $City%>
<%set url3 = combine( $url, $url2 )%>
<%passurl ('$url3')%>

and passurl global

sub {
my $url = $_[0];
if ($url =~ /^http/i){
require LWP::Simple;
return LWP::Simple::get($url || return);
}
else
{return system($url);
}
}


If there is easier way, lemme knowCool

Last edited by:

Suomi: Dec 5, 2004, 12:42 PM