By: bisdak (offline)  Mar 13 2012 13:36 pm (Read 774 times)  

I want to add the following line to some staticpages

PHP Formatted Code
<?php require_once ('count.php'); ?>



instead this is being converted to:

PHP Formatted Code
<!-- ?php require_once ('count.php'); ? -->



which of course will not be recognized by the php parser as a line of code.

Is there no way round this.

Thanks


Tita T
------
ex University of San Carlos Cebu | Sta Tomas Manila
Proudly Visayan now living in Europe
------

bisdak



Group Comfort
Level:
: +6
Registered:: 08/14/09

Posts: 344
By: bisdak (offline)  Mar 13 2012 18:19 pm  

Before posting my query I had read the other forum posts regarding php in static pages none of the advice helped or solved the query I had, hence my posting.

I have found a workaround which seems to work whether it is the right solution I do not know.

I set up an autotag with the name counter and was able to put

PHP Formatted Code
[counter:%0%]

as the first line in the static page it does seem to work which is suppose all I can ask - if there is a better solution please post so I can implement it.

Thanks


Tita T
------
ex University of San Carlos Cebu | Sta Tomas Manila
Proudly Visayan now living in Europe
------

bisdak




Group Comfort
Level:
: +6
Registered:: 08/14/09

Posts: 344
By: lgarner (offline)  Mar 13 2012 20:32 pm  

As I recall, when "execute PHP" is on in a static page it is all treated as PHP. I think you need to close the PHP tag, or omit the opening tag if PHP is your first item. For instance:

PHP Formatted Code
?> Some non-php text
goes here.
<?php echo $counter;?>
Some more text, now to re-open PHP at the end
<?php

lgarner



Group Comfort
Level:
: +52
Registered:: 06/10/08

Posts: 1948
By: bisdak (offline)  Mar 13 2012 21:55 pm  

Thanks Lee will give it a try as

PHP Formatted Code
require_once '../count.php'; ?>



as the first item on the first line and see how it goes.



Tita T
------
ex University of San Carlos Cebu | Sta Tomas Manila
Proudly Visayan now living in Europe
------

bisdak



Group Comfort
Level:
: +6
Registered:: 08/14/09

Posts: 344
By: bisdak (offline)  Mar 13 2012 22:02 pm  

Lee it prints the line on screen could it be something to do with Advanced Editor and that is changing the syntax of the line. it is putting a "<p>" in front of the line and the same behind.

It is even wrapping the Autotag I put in but does seem to work, do you think I would be better keep that as a Q&D fix for the problem.

Thanks


Tita T
------
ex University of San Carlos Cebu | Sta Tomas Manila
Proudly Visayan now living in Europe
------

bisdak



Group Comfort
Level:
: +6
Registered:: 08/14/09

Posts: 344
By: Mark (offline)  Mar 13 2012 22:04 pm  

You can't use the advanced editor to embed PHP code. The advanced editor is designed to take what you type and display it, so it will translate <? to &gt;?. You must use the text HTML editor when you want to embed PHP code into a static page.

Thanks!
Mark


glFusion - Enhanced Content Management

Mark



Group Comfort
Level:
: +112
Registered:: 10/21/05

Posts: 6441
By: bisdak (offline)  Mar 13 2012 22:11 pm  

That answers that so I best stick with my Q&D autotag fix as it seems to work - win some lose some.

Thanks Mark


Tita T
------
ex University of San Carlos Cebu | Sta Tomas Manila
Proudly Visayan now living in Europe
------

bisdak



Group Comfort
Level:
: +6
Registered:: 08/14/09

Posts: 344
7 posts :: Page 1 of 1
All times are CDT. The time is now 07:35 pm.
Normal Topic Normal Topic
Locked Topic Locked Topic
Sticky Topic Sticky Topic
New Post New Post
Sticky Topic w/ New Post Sticky Topic w/ New Post
Locked Topic w/ New Post Locked Topic w/ New Post