GetSimple Support Forum

Full Version: Call a page from the theme directly
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
Hi,

how, in my php code, I can call a page directly (without using the admin page control panel) ?
ie: have a page in my theme : under-construction.php but when I calll it (somewhere else in my code) like this :

PHP Code:
<a href="<?php get_theme_url(); ?>/under-construction.php">Consulting</a

I get "you cannot load this page directly." which is normal and what I can expect but how to load it 'normally' like if I use it thru a page ? is there any way ?

thanks in advance,
Domi.
The solution I have found :

1) create a page "under-construction" with status private and template "under-construction.php"
2) call it like this :

PHP Code:
<a href="<?php get_site_url(); ?>index.php?id=under-construction">Consulting</a


is there another simpler solution and without creating a page ?

Domi.
(2020-06-14, 18:30:49)Domi Wrote: [ -> ]
PHP Code:
<a href="<?php get_theme_url(); ?>/under-construction.php">Consulting</a

I get "you cannot load this page directly." which is normal and what I can expect but how to load it 'normally' like if I use it thru a page ? is there any way ?

You can access the file directly, this should not be a problem, but your code will be executed outside of the GS concept and you will not be able to use the GS functions. IN_GS is a GS constant which is not set in this case. Delete all GS functions from the file and call it again. Remove this:
if(!defined('IN_GS')){ die('you cannot load this page directly.'); }
Hi,

Also with the i18n plugin you can make links to pages:

<a href="<?php echo find_url('index',null); ?>">home</a>

Just replace index and home with the page slug and page name you need.

More info here:
http://mvlcek.bplaced.net/get-simple/mul...avigation/