Jump to content

using a variable in a class


webguy262

Recommended Posts

I have a class that creates a grid from an xml feed. 

 

The class file is attached.

 

The grid displays on a page which is defined within the class as follows:

 

private $results_page = '/foobar.php';

 

I'm including the same class in multiple folders (the folders are addon domains) so I can have just one copy of the class so it is easy to modify.

 

The problem is that I need to add a variable containing the folder name to the $results_page path, so that when the class executes within each folder, the $results_page is 'FOLDER//foobar.php'

 

I have a file with defines in each folder, and I have tried including that file in the class and using the defined var in the construct, but I can't get it to work.

 

What am I missing?

 

[attachment deleted by admin]

Link to comment
https://forums.phpfreaks.com/topic/235503-using-a-variable-in-a-class/
Share on other sites

The class makes a soap call to get an xml feed and then creates a grid showing the data.  I did not write the application, I'm just trying to adapt it for use with multiple sites. I could put a copy of the class file in each domain folder, but I prefer having one copy of the file to make modification easier.

 

On the designated $results_page, the class file gets called as follows:

 

<?php
include('../classes/class.grid.php'); 
$grid = new grid(); 
print $grid->displayEventByEventIDInteractive($_GET['eventID']);
?>

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.