PHP integration RW7


(John Minogue) #1

I have recently built a site for a custoemer and needed to integrate PHP code into the pages. For items above the this was easy as RW provides a GUI inteface to do this. What was a pain was I also needed to add somecode after the tage i.e. the very last line of the page code. This I could not do via RW. I have to publish the site and manually edit the file to add the content and overwrite the files on the server.

I also needed to insert a call to a function to display data where I wanted on the page, again this was a manual task to edit and overwrite the published page.

It would be nice if this could be managed and controller from inside RW7.

cheers
J/


(Scott Steven) #2

How did you build the pages. What pluggins did you use? I can’t see having to do this with a stacks page. We do this with both PHP and .Lasso for different sites with out issues.


(John Minogue) #3

This is a standard Stacks page. I have not used any specific plugins I just wanted to insert the PHP code before the DOCTYPE, which is no issue, RW prvides a way to do this. Inserting code after the tag is not so easy as this has to be code manually after publishing. Inserting a PHP function call in the page where I want it is also a manual task after publishing.

If one could view the source for the page and actually editing it before publishing this would be an option or if there are specific PHP plugins I can use then this would also be ok.

regards
JOhn


(Scott Steven) #4

You dont need to wait for RW 7 to do this. Its very easy in RW 6. I am doing this with RW6, Use the inspector for the Page and paste your snippet into the Prefix for the page it will look like this in the code. This is a sample from sitelok .

> <?php 
> $groupswithaccess="CLIENT"; 
> require_once("../slpw/sitelokpw.php"); 
> ?> 
> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
> <html xmlns="http://www.w3.org/1999/xhtml">
> 	<head>
>

(John Minogue) #5

many thanks Scott,

I was aware of the Prefix to insert PHP (or any code) before the <!DOCTYPE> but the main issue is inserting PHP code or function calls ANYWHERE in the page. For what I am using I need to place a call to a function {YP_LISTINGS} in the page where I would like my cusstomers offerss to be displayed from the database. I have tried a number of ways to do this inside RW6 but so far none have worked. I also need to add some code as the very last line of the page code, after the tag, again there is no easy way to do this other than manually editing the file after export.

regards
John


(Scott Steven) #6

All of my pages are stacks pages. I also create utility pages that are just HTML. then when I use plus kit to @import them when I need to in my stacks.

as far as after the footer I have not tried anything there