Topic: how to insert php code to pages

i want to edit my 404 template

i got this code inside the page

<h2>404 Page Not Found</h2>
<p>We're sorry but the page you are looking for doesn't appear to exist!</p>
<p>Please go back in your browser, or click the link to return to website.</p>
<p><a href="<?php echo Site::url(); ?>">website.com</a></p>

but <?php echo Site::url(); ?> doesn't work here


regards bernte

Re: how to insert php code to pages

you can edit it in "pages -> edit 404 pages"

but remember, you have to make a "error.template.php" or "404.template.php" first. and then you select "settings", and change your template.

I'm not like them but I can pretend.

3 (edited by bernte 2013-11-17 14:57:56)

Re: how to insert php code to pages

Hi Aryandhani...

thats all i have done before... i think you have missunderstood my question.

i try to explain again!

i click on Pages -> Edit 404 Page

there i insert

<h2>404 Page Not Found</h2>
We're sorry but the page you are looking for doesn't appear to exist!
Please go back in your browser, or click the link to return to website.
<a href="<?php echo Site::url(); ?>">website.com</a>

then i go to frontend and call a link which doesn't exist!
the 404 template works but not the php-part of <?php echo Site::url(); ?>

my sourcecode from the frontend looks like this

<h2>404 Page Not Found</h2>
We're sorry but the page you are looking for doesn't appear to exist!
Please go back in your browser, or click the link to return to website.
<a href="<?php echo Site::url(); ?>">website.com</a>

all i want to know how to echo the site-url inside Pages (without typing manually)

Re: how to insert php code to pages

ahh.. yes. sorry, I apparently misunderstood big_smile

if that's the problem. I still do not understand hehe

I'm not like them but I can pretend.

Re: how to insert php code to pages

Why don't you just write this native PHP code?

<a href="<?php echo 'http://' . $_SERVER['HTTP_HOST'] . $_SERVER['REQUEST_URI']; ?>">link</a>
XSS Testing <script>alert('HIYAA!!!');</script>

tovic's Website

6 2013-12-06 12:02:49

Re: how to insert php code to pages

have you tried your code?

i also tried it on normal pages! (START PAGE)
seems that i can't run php from here?

your code:

<a href="<?php echo 'http://' . $_SERVER['HTTP_HOST'] . $_SERVER['REQUEST_URI']; ?>">link</a>

gives me on frontend:

http://website.com/monstra/<?php echo 'http://' . $_SERVER['HTTP_HOST'] . $_SERVER['REQUEST_URI']; ?>

php doesn't parse here!

7 2013-12-06 12:13:50

Re: how to insert php code to pages

got it.. this works

<h2>404 Page Not Found</h2>
We're sorry but the page you are looking for doesn't appear to exist!
Please go back in your browser, or click the link to return to website.
<a href="{siteurl}">{siteurl}</a>

Re: how to insert php code to pages

How? Are you trying to write PHP code inside the post composer form? If so, then now I understand your problem from the start.

XSS Testing <script>alert('HIYAA!!!');</script>

tovic's Website