Gossamer Forum
Home : Products : Gossamer Links : PHP Front End :

Dynamic php in static pages

Quote Reply
Dynamic php in static pages
Perhaps that has been covered before.

Is it possible to inlcude dynamic elements in the static output pages.

For example, on a 10,000 page site it would be nice bot to have to build the whole lot again if for example I changed the adsense code.

eg simple changing a file on the server that gets calle as an SSI.

<?php include("/usr/etc/etc/path_to_document/adsence") ?>

But during the build that will be interpreted and run, is is possible or safe to to comment that out in some way?

\<\?php include(\"/usr/etc/etc/path_to_document/adsence\") \?\>

Thats a wild guess by the way, escpaing characters is a nightmare, at leats it is not VB with is millions of """"""""" :)
Quote Reply
Re: [ukseo] Dynamic php in static pages In reply to
If you are building .php pages (i.e index.php, more2.php, etc) ... then you should just be able to use you're PHP code "as-is" ...i.e;

<?php include("/usr/etc/etc/path_to_document/adsence") ?>

If you want to make a global, for dynamic scripts (i.e search.cgi, add.cgi, etc)... then you could try a global like so;

Code:
sub {
my $url = $_[0];
use LWP::Simple;
my $got = get($url);
return $got;
}

... and call with;

<%global_name('http://www.page-to-grab.com/page.php')%>

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: [ukseo] Dynamic php in static pages In reply to
Cheers Andy

But i am not sure, i was just thinking along the lines of inl;cuding dymanic bits of php

eg

<?php
echo date ("m/d/Y", 0
);
?>


But actually having that called when the page is requested not built, so when you look at the flat pages you would see the time for that moment, not the time for when the page was compiled

cheers
Quote Reply
Re: [ukseo] Dynamic php in static pages In reply to
In that case, just set your build_extension to .php, and put your PHP calls in the templates. For dynamic pages, you should be able to use;

Code:
sub {
my $cmd = $_[0]
my $got = system($cmd);
return $got;
}
,... and call with;

<%global_name('/usr/bin/php /full/path/to/php/script.php')%>

.. and then in script.php, put something like;

Code:
<?
echo date ("m/d/Y", 0);
?>

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!