PDA

View Full Version : PHP in Actinic HTML Question


kathynewman
02-Dec-2008, 01:48 PM
Wonder if anyone can help. I have some code which I want to include in a brochure page - the code includes some php as well as html. When I paste the code in and do preview I can see the html coding works ok but the php doesn't - when I upload to the web the page doesn't appear to have been generated. Is there something specific I need to do to get the php to work?

I know almost nothing about php and wonder if any kind soul could point me in the right direction to get this to work!

Thanks in advance

Kathy

grantglendinnin
02-Dec-2008, 01:52 PM
Kathy,

This php to html (http://php.about.com/od/advancedphp/p/html_php.htm) execution help should solve your problems I suspect:)

Cheers,
Grant

NormanRouxel
02-Dec-2008, 02:43 PM
Kathy,

If that page isn't your home page (and you're not depending on links to it from search engines) then try renaming it to end in .php via Page Settings / Page Filename.

That should be all you need to do for the PHP to be executed.

If search engine links to that page are important to you then see the page Grant referred to.

kathynewman
02-Dec-2008, 02:53 PM
Thanks Norman - I did change the page name to be .php - when I do an offline preview within actinic I see the actual php code and when I upload and look I get a blank page!

This page doesn't need to be found by search engines at all.

leehack
02-Dec-2008, 02:55 PM
Can you show us your code then Kathy.

kathynewman
02-Dec-2008, 03:08 PM
Sure can Lee (disclaimer - I did NOT write this code -:D)

leehack
02-Dec-2008, 03:13 PM
It has its own head and body tag as in its a page in its own right. If you want to embed it into a page on your site, you need to get it back to just the inner code. You can't have 2 heads or 2 body tags etc. as your brochure page will already have that for you.

kathynewman
02-Dec-2008, 04:08 PM
Thanks Lee - removed the head & body tag and still same result. Back to drawing board I think!

leehack
02-Dec-2008, 04:27 PM
Can we see it live? or the amended code?

kathynewman
02-Dec-2008, 04:44 PM
Live doesn't appear - just uploaded the amended code and done view source and there is nothing appearing in the view source. Amended code is below but literally just took out the head & body stuff

Probably something really obvious (but struggling today feeling poorly and trying to work - well thats my excuse anyway :) )

NormanRouxel
02-Dec-2008, 06:13 PM
Kathy,

Lets make sure you can run some simple PHP, before trying that humungous add-on.

Put this into a Brochure Fragment entry in the Text field.

!!<<?php phpinfo(); ?>>!!

Save the page with a .php name.

Now Upload and look at that page (live site only - Preview won't work) and you should see a lot of info about your servers PHP setup being displayed.

Let us know if that happens.

kathynewman
02-Dec-2008, 07:48 PM
Thanks Norman - that worked got lots of PHP
http://www.puddlepetcare.co.uk/acatalog/test_php.php

so now to try and work out why the other code isn't working!

NormanRouxel
02-Dec-2008, 10:41 PM
OK. PHP is go. I'd now look at your code and remove all the stuff that refers to files or images outside your Site folder. All these files and images should be kept directly in your Site folder.

E.g.

background="images/top-l.gif"

becomes

background="top-l.gif"

and

include("http://www.puddlepetcare.co.uk/scratchcard/include/functions.inc.php");

becomes

include("functions.inc.php");

and make sure all these files get uploaded by adding them to Design / Additional Files.

kathynewman
03-Dec-2008, 07:53 AM
Thanks Norman - tried that and it didn't make any difference.

What is odd is that when I put in a fragment the code you suggested
!!<<?php phpinfo(); ?>>!!

I didn't see anything in the actinic preview pane.

However when I stripped out all the html and just put in the php for the stuff I'm trying to do I do see this:
0) { $p = new pagination(); $p->Items($total); $p->limit($limit); $p->target('winners.php'); $p->currentPage($_GET['page']); $p->calculate(); $p->changeClass("pagination"); } include("templates/winners.html"); ?>

Will have to have another look later when I'm doing packing!

dallen
03-Dec-2008, 09:24 AM
Looking at the source of http://www.puddlepetcare.co.uk/acatalog/test_php.php shows that you still have 2 sets of html, head and body tags. Lines 16 to 623 contain an entire web page (starting with the opening HTML tag and ending with the closing HTML tag). I'd suggest getting this sorted before proceeding...

NormanRouxel
03-Dec-2008, 09:37 AM
What is odd is that when I put in a fragment the code you suggested
!!<<?php phpinfo(); ?>>!! I didn't see anything in the actinic preview pane.
That's normal. We're using PHP that runs on your server. <?php ... ?> will not work offline. Actinic's built-in PHP is not in use here.

kathynewman
03-Dec-2008, 10:04 AM
Thanks Dave - that was just a test page - the page I am trying to get working is
http://www.puddlepetcare.co.uk/acatalog/Scratch_Card_Winners.php

weird as its not generating any code - even after a web refresh!

dallen
03-Dec-2008, 10:46 AM
oops my bad - didn't read the content of the embedded page - it was meant to be there!

gabrielcrowe
03-Dec-2008, 10:48 AM
additionally, when a server is configured for silent errors, a php page with syntax or compilation errors will appear simply blank.

gabrielcrowe
03-Dec-2008, 10:50 AM
really, in this code this is the only useful part:

<? php
include("http://www.puddlepetcare.co.uk/scratchcard/include/functions.inc.php");
include("http://www.puddlepetcare.co.uk/scratchcard/include/pagination.php");
connect();
$limit=25;
if(!isset($_GET[page]))
$page=1;
else
$page=$_GET[page];
$winners = getLatestWinners($page,$limit);
$total = getTotalWinners();
if($total>0)
{
$p = new pagination();
$p->Items($total);
$p->limit($limit);
$p->target('winners.php');
$p->currentPage($_GET['page']);
$p->calculate();
$p->changeClass("pagination");
}
include("templates/winners.html");
?>

tell us where its from, and a testing download, and then perhaps i can get you some actinic code...

thats last include path is:
http://www.puddlepetcare.co.uk/scratchcard/templates/winners.html

kathynewman
03-Dec-2008, 11:38 AM
Thanks Gabe (and everyone else trying to help me!)

What I am trying to achieve is to get the following into actinic brochure pages so that whole thing is branded as Puddle Pet Care.

http://www.puddlepetcare.co.uk/scratchcard/

I have no problems with the standard html pages (such as rules) but the issues start when there is php code.

Thought this was going to be easy (should have known better :D)