I have a class that creates a spry based tab set for users. The class itself takes builds html which i then echo out. The problem i'm having is one of my class variables is a filename (specifically, the file you want said tab to display) This file could (and probably will) be php with dynamic content. I need to do something along the lines of a readfile where the server processes the page and just returns me the results to display in the tab. Can someone help. Here is my class.
Code: Select all
class Tabs {
#All these variables should be arrays with the same ammount of values
public $NameTabs;
public $TabFiles;
public function __construct($NameTabs, $TabFiles) {
$this->NameTabs = $NameTabs;
$this->TabFiles = $TabFiles;
}
public function ReturnTabs() {
$Tab = '<div id="TabbedPanels" class="TabbedPanels">';
$Tab .= '<ul class="TabbedPanelsTabGroup">';
$i = 0;
foreach($this->NameTab as $NT) {
$Tab .= '<li class="TabbedPanelsTab" tabindex="' . $i . '">' . $NT . '</li>';
$i++;
}
$Tab .= "</ul>";
$Tab .= '<div class="TabbedPanelsContentGroup">';
$i = 0;
foreach($this->TabFiles as $TF) {
$Tab .= '<div class="TabbedPanelsContent" id="TB' . $i . '">';
$Tab .= readfile($TF); //THIS IS THE LINE THAT KEEPS HOSING ME
$Tab .= "</div>";
$i++;
}
$Tab .= "</div>";
$Tab .= "</div>";
$Tab .= '<script type="text/javascript">';
$Tab .= "var TabbedPanels1 = new Spry.Widget.TabbedPanels('TabbedPanels');";
$Tab .= "</script>";
return $Tab;
}
}