PDA

View Full Version : How do you set up a PHP page?



n2fshn
01-18-2010, 03:43 PM
I created a new PHP page and then made a test.php file like this:


<?php
define('THIS_SCRIPT', 'test');
$fh = fopen("myfile.txt", "r");

$line = fgets($fh);
echo $line;

fclose($fh);

?>

I set the path to the php file, and then added the custom page content module but nothing comes up on the page. If I type in the url of the test.php file directly it comes up in the browser.

This is my first attempt at trying to create a php page with vbadvanced. Am I missing something?

Brian
01-18-2010, 05:32 PM
Looks like your issue might be related to this bug:
http://www.vbadvanced.com/forum/showthread.php?t=38728

Our Sponsors
 

n2fshn
01-18-2010, 07:05 PM
Thank you Brian. That was exactly the problem and when I uploaded the new files, it worked.

However that did not solve my problem.

What I am trying to accomplish is to use the " define('THIS_SCRIPT', 'test'); " to tell the navbar that I am on a particular page and I want the button that I created for that page to be highlighted.

I'm guessing since I used the php file within a module, it's not recognizing the " define " call.

Does anybody have any idea how to do this? I would love to use the vb4 navbar and then link the buttons to my vba pages.

Brian
01-19-2010, 02:12 PM
THIS_SCRIPT is defined as 'adv_index' at the beginning of the cmps_index.php file (or whatever it's been renamed to), so it's already defined before your custom file is included. You should be able to use a condition that looks something like this though:

if (THIS_SCRIPT == 'adv_portal' AND $pages['name'] == 'test')
(change 'test' at the end there to whatever you used for the 'Page Identifier' setting for your custom page)

Our Sponsors
 

n2fshn
01-19-2010, 03:59 PM
Thank you Brian, that worked perfectly.

I had to change the script name though, because in 4.0 it is adv_index, not adv_portal.


if (THIS_SCRIPT == 'adv_index' AND $pages['name'] == 'test' OR 'new')

I also used OR to apply the function to multiple pages.

Thanks again and keep up the good work with this fine product. Your cmps blows away the vb cms. I have turned off the cms on my 4.01 and I will be using vba cmps from now on!