Page 1 of 1

Including PHP script in PHPWCMS

Posted: Tue 6. Jun 2006, 10:07
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?

Posted: Wed 7. Jun 2006, 19:46
by Starbase01.com
Anyone?

Posted: Wed 7. Jun 2006, 21:02
by Pauli
you forgot a ;

[PHP]
include "/gallery/index.php";
[/PHP]

Posted: Wed 7. Jun 2006, 21:42
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

Posted: Wed 7. Jun 2006, 22:10
by pico
Hi

think that it will not work in this way - maybe you try to use a iFrame Solution

Posted: Wed 7. Jun 2006, 22:22
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

Posted: Wed 7. Jun 2006, 22:40
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.

Posted: Wed 7. Jun 2006, 22:50
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>

Posted: Thu 8. Jun 2006, 19:12
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?

Posted: Sun 25. Jun 2006, 09:44
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?