Including PHP script in PHPWCMS

Get help with installation and running phpwcms here. Please do not post bug reports or feature requests here.
Post Reply
Starbase01.com
Posts: 31
Joined: Thu 30. Dec 2004, 15:05
Contact:

Including PHP script in PHPWCMS

Post by Starbase01.com »

I've installed a 3rd party script on my website.
I would like to include it into my PHPWCMS setup.
So I decided to use:
[PHP]
[PHP]
include "/gallery/index.php"
[/PHP]

This however results in this error:
Parse error: parse error, unexpected '&' in /usr/home/<username>/domains/starbase01.com/public_html/include/inc_front/front.func.inc.php(2048) : eval()'d code on line 3

When I try to directly access the script:
http://www.starbase01.com/gallery/index.php
it works fine.

What could be the problem?
Image
Starbase01.com
Posts: 31
Joined: Thu 30. Dec 2004, 15:05
Contact:

Post by Starbase01.com »

Anyone?
Image
Pauli
Posts: 92
Joined: Mon 30. Aug 2004, 11:53

Post by Pauli »

you forgot a ;

[PHP]
include "/gallery/index.php";
[/PHP]
Starbase01.com
Posts: 31
Joined: Thu 30. Dec 2004, 15:05
Contact:

Post by Starbase01.com »

Thanks, but fortunatly that didn't fix the issue.

Parse error: parse error, unexpected '&' in /usr/home/<USERNAME>/domains/starbase01.com/public_html/include/inc_front/front.func.inc.php(2048) : eval()'d code on line 1
Image
User avatar
pico
Posts: 2595
Joined: Wed 28. Jul 2004, 18:04
Location: Frankfurt/M Germany
Contact:

Post by pico »

Hi

think that it will not work in this way - maybe you try to use a iFrame Solution
Lieber Gott gib mir Geduld - ABER BEEIL DICH
Horst - find me at Musiker-Board
User avatar
DeXXus
Posts: 2168
Joined: Fri 28. Nov 2003, 06:20
Location: USA - Florida

Post by DeXXus »

Maybe this?

Code: Select all

$phpwcms["allow_cntPHP_rt"]   = 0; //allow PHP replacement tags and includes in content parts
Try an experiment... Do you get the same error with these?

Code: Select all

{PHP:/usr/home/<USERNAME>/domains/starbase01.com/public_html/gallery/index.php}

Code: Select all

{URL:http://www.starbase01.com/gallery/index.php}
May need to enable (change from 0 to 1) features in "conf.inc.php":

Code: Select all

$phpwcms["allow_remote_URL"]  = 0; //0 = no remote URL in {PHP:...} replacement tag allowed, 1 = allowed

$phpwcms["allow_cntPHP_rt"]   = 0; //allow PHP replacement tags and includes in content parts
Starbase01.com
Posts: 31
Joined: Thu 30. Dec 2004, 15:05
Contact:

Post by Starbase01.com »

Hi,

Thanks for the tips, here are the results:
DeXXus wrote:Maybe this?

Code: Select all

$phpwcms["allow_cntPHP_rt"]   = 0; //allow PHP replacement tags and includes in content parts
No different with either 1 or 0 in that code
Try an experiment... Do you get the same error with these?

Code: Select all

{PHP:/usr/home/<USERNAME>/domains/starbase01.com/public_html/gallery/index.php}
Nothing loads

Code: Select all

{URL:http://www.starbase01.com/gallery/index.php}
I see something of the other file, but when clicking on content it takes over the active window and no longer shows the rest of the site, just that page.
May need to enable (change from 0 to 1) features in "conf.inc.php":

Code: Select all

$phpwcms["allow_remote_URL"]  = 0; //0 = no remote URL in {PHP:...} replacement tag allowed, 1 = allowed

$phpwcms["allow_cntPHP_rt"]   = 0; //allow PHP replacement tags and includes in content parts
No changes on either 1 or 0.
Image
User avatar
pico
Posts: 2595
Joined: Wed 28. Jul 2004, 18:04
Location: Frankfurt/M Germany
Contact:

Post by pico »

try this

make a HTML Contentpart with this

Code: Select all

<iframe id="myframe" src= "/gallery/index.php" scrolling="no" marginwidth="0" marginheight="0" frameborder="0" vspace="0" hspace="0" style="overflow:visible; width:100%; display:none"></iframe>
in Template add this Script into HTML-Header

Code: Select all

<script type="text/javascript">

/***********************************************
* IFrame SSI script II- © Dynamic Drive DHTML code library (http://www.dynamicdrive.com)
* Visit DynamicDrive.com for hundreds of original DHTML scripts
* This notice must stay intact for legal use
***********************************************/

//Input the IDs of the IFRAMES you wish to dynamically resize to match its content height:
//Separate each ID with a comma. Examples: ["myframe1", "myframe2"] or ["myframe"] or [] for none:
var iframeids=["myframe"]

//Should script hide iframe from browsers that don't support this script (non IE5+/NS6+ browsers. Recommended):
var iframehide="yes"

var getFFVersion=navigator.userAgent.substring(navigator.userAgent.indexOf("Firefox")).split("/")[1]
var FFextraHeight=parseFloat(getFFVersion)>=0.1? 16 : 0 //extra height in px to add to iframe in FireFox 1.0+ browsers

function resizeCaller() {
var dyniframe=new Array()
for (i=0; i<iframeids.length; i++){
if (document.getElementById)
resizeIframe(iframeids[i])
//reveal iframe for lower end browsers? (see var above):
if ((document.all || document.getElementById) && iframehide=="no"){
var tempobj=document.all? document.all[iframeids[i]] : document.getElementById(iframeids[i])
tempobj.style.display="block"
}
}
}

function resizeIframe(frameid){
var currentfr=document.getElementById(frameid)
if (currentfr && !window.opera){
currentfr.style.display="block"
if (currentfr.contentDocument && currentfr.contentDocument.body.offsetHeight) //ns6 syntax
currentfr.height = currentfr.contentDocument.body.offsetHeight+FFextraHeight; 
else if (currentfr.Document && currentfr.Document.body.scrollHeight) //ie5+ syntax
currentfr.height = currentfr.Document.body.scrollHeight;
if (currentfr.addEventListener)
currentfr.addEventListener("load", readjustIframe, false)
else if (currentfr.attachEvent){
currentfr.detachEvent("onload", readjustIframe) // Bug fix line
currentfr.attachEvent("onload", readjustIframe)
}
}
}

function readjustIframe(loadevt) {
var crossevt=(window.event)? event : loadevt
var iframeroot=(crossevt.currentTarget)? crossevt.currentTarget : crossevt.srcElement
if (iframeroot)
resizeIframe(iframeroot.id);
}

function loadintoIframe(iframeid, url){
if (document.getElementById)
document.getElementById(iframeid).src=url
}

if (window.addEventListener)
window.addEventListener("load", resizeCaller, false)
else if (window.attachEvent)
window.attachEvent("onload", resizeCaller)
else
window.onload=resizeCaller

</script>
Lieber Gott gib mir Geduld - ABER BEEIL DICH
Horst - find me at Musiker-Board
Starbase01.com
Posts: 31
Joined: Thu 30. Dec 2004, 15:05
Contact:

Post by Starbase01.com »

Looks like that did the trick!

http://www.starbase01.com/index.php?id=24,75,0,0,1,0

Thanks!

Now all that remains is to adapt the layout of the script!


Is there perhaps also a way to have the following done.
When someone for example copy pastes the URL of the gallery into a new window, that the layout of the site is loaded around it by default?

So when someone tries to access http://www.starbase01.com/gallery/* (any file in that folder) the page above is loaded automatically?
Image
Starbase01.com
Posts: 31
Joined: Thu 30. Dec 2004, 15:05
Contact:

Post by Starbase01.com »

I have now created the page for the script in the CMS. The CMS opens the script via an Iframe.

<iframe id="mygallery" src= "/gallery/index.php" scrolling="no" frameborder="0" vspace="0" hspace="0" style="overflow:visible; width:100%; display:none"></iframe>

Inside the gallery I have included this code to check if the Iframe has been loaded:
<script>
if (top == self)
{ //no frame
window.location = 'http://www.starbase01.com/index.php?id=24,0,0,1,0,0';
}
</script>
This so visitors always see the rest of the site as well.

The issue I have is when people for example try to access one of the galleries directy (for example the Airplanes) using it's URL:
http://www.starbase01.com/gallery/index ... w&gazgal=5
they end up at the index of the galleries.

Does anyone know of any way to accomplish this?
Image
Post Reply