GetSimple Support Forum
load code if page is - Printable Version

+- GetSimple Support Forum (http://get-simple.info/forums)
+-- Forum: GetSimple (http://get-simple.info/forums/forumdisplay.php?fid=3)
+--- Forum: Developer Discussions (http://get-simple.info/forums/forumdisplay.php?fid=8)
+--- Thread: load code if page is (/showthread.php?tid=4418)



load code if page is - kennylovesyou - 2013-03-05

Hi all

I've been using GS for a few months now and just love how clean and simple it is to setup easy to manage websites.

I was wondering if its possible to load a section of code in the template file if a specified page(s) are loaded.

Does anyone know if this is possible and if so how?

Thanks guys.


RE: load code if page is - Carlos - 2013-03-05

For one page:
PHP Code:
<?php if (return_page_slug()=='page') { ?>
... code ...
<?php ?>

For several pages:
PHP Code:
<?php if (in_array(return_page_slug(),array('page1','page2','page3'))) { ?>
... code ...
<?php ?>



RE: load code if page is - kennylovesyou - 2013-03-05

Excellent! Thank you Carlos!

Its simple when you know how Smile

(2013-03-05, 06:37:07)Carlos Wrote: For one page:
PHP Code:
<?php if (return_page_slug()=='page') { ?>
... code ...
<?php ?>

For several pages:
PHP Code:
<?php if (in_array(return_page_slug(),array('page1','page2','page3'))) { ?>
... code ...
<?php ?>