Gossamer Forum
Home : Products : Gossamer Links : Discussions :

Dynamic Vs Static Issue

Quote Reply
Dynamic Vs Static Issue
I am working on setting up different content for dynamic & static pages, however am little confused with current situation. Normally dynamic pages have d=1 in the url, however can anyone tell me, why is domain.com/cgi/page.cgi?p=custompagename also being considered dynamic?

Vishal
-------------------------------------------------------
Quote Reply
Re: [SWDevil.Com] Dynamic Vs Static Issue In reply to
Hi,

Because that is dynamic :P

The solution I came up with for checking to see if a page is static, or dynamic - was with a global:

check_if_dynamic
Code:
sub {
if (!$ENV{SCRIPT_URL}) {
return { is_dynamic => 0 }
} elsif ($ENV{SCRIPT_URL} =~ /\Qnph-build.cgi/) {
return { is_dynamic => 0 }
} else {
return { is_dynamic => 1 }
}
}

Then call with this in your header file:

Code:
<%check_if_dynamic%>

..and then wherever you wannt see if a page is dynamic, do:

Code:
<%if is_dynamic%>
.. its dynamic
<%else%>
its a static page
<%endif%>

Seems to be working for what I used it on :)

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: [Andy] Dynamic Vs Static Issue In reply to
Hi Andy,

Right now I am using your other global
Code:
sub {
my $p = $IN->param('g') || $IN->param('p') || $IN->param('page') || $IN->param('d');
$p ? return { is_dynamic => 1 } : return { is_dynamic => 0 }
}

Calling it via:
Code:
<%is_dynamic%>

Code:
<%if is_dynamic eq '1'%>
.. Dynamic Content Here
<%elsif is_dynamic eq '0'%>
... Static Content Here
<%endif%>


So I suppose, I can just edit the global code and it would work just fine. As this new global will mean, there is no need to use the older one, right?

Vishal
-------------------------------------------------------
Quote Reply
Re: [SWDevil.Com] Dynamic Vs Static Issue In reply to
Ah, don't remember writing that one <G> That should work fine for you? Obviously if you are calling a script via page.cgi?g=xxx, then it WILL be treated as a dynamic page - cos it IS a dynamic page =)

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!