Note that there are some explanatory texts on larger screens.

plurals
  1. POPHP works locally, not on server
    primarykey
    data
    text
    <p>I've been developing a custom CMS using Codeigniter locally and I've just gotten to the point where I need to upload it to a staging server to do some more testing.</p> <p>Everything works except for the sidebar section of the site that uses a widget system. I initially thought it was just differences between PHP versions, as I am running 5.4.4 locally and the server was 5.3. After upgrading the server to 5.4.7, the sidebar is still not appearing. I get no error, just nothing displays.</p> <p>This is the Widget library code:</p> <pre><code>&lt;?php if (!defined('BASEPATH')) exit('No direct script access allowed'); class Widgets { private $_ci; protected $parser_enable = FALSE; public function __construct() { $this-&gt;widgets(); } public function widgets(){ $this-&gt;_ci =&amp; get_instance(); } public function build($view,$data=array()){ $view = get_class($this).'/'.$view; $subdir = ''; if (strpos($view, '/') !== FALSE) { // explode the path so we can separate the filename from the path $x = explode('/', $view); // Reset the $class variable now that we know the actual filename $view = end($x); // Kill the filename from the array unset($x[count($x)-1]); // Glue the path back together, sans filename $subdir = implode($x, '/').'/'; } $widget_view = APPPATH.'widgets/'.$subdir.'views/'.$view.EXT; if(file_exists($widget_view)){ $widget_view = '../widgets/'.$subdir.'views/'.$view.EXT; if($this-&gt;parser_enable){ $this-&gt;_ci-&gt;load-&gt;library('parser'); return $this-&gt;_ci-&gt;parser-&gt;parse($widget_view,$data,TRUE); } else{ return $this-&gt;_ci-&gt;load-&gt;view($widget_view,$data,TRUE); } } return FALSE; } public function __get($var) { static $ci; isset($ci) OR $ci = get_instance(); return $ci-&gt;$var; } } </code></pre> <p>Does anything jump out that could cause it not to display?</p> <p>Is there anything I should be looking at to make it compatible, such as server modules? What on the server could be affecting this?</p> <p>EDIT:</p> <p>I have the widgets residing in the following path:</p> <pre><code>/public_html/application/widgets/recent_news/views/view.php </code></pre> <p>The <code>$widget_view = 'widgets/'.$subdir.'views/'.$view.EXT;</code> variable is returning <code>widgets/Recent_news/views/view.php</code> which is getting passed to:</p> <pre><code>if(file_exists($widget_view)){ return $this-&gt;_ci-&gt;load-&gt;view($widget_view,$data,TRUE); } </code></pre> <p>The application path in $widget_view doesn't seem to be correct on the staging server, so file_exists() returns false and doesn't load the view (which would have an incorrect path anyways).</p> <p>I just can't seem to make it read the correct path, any suggestions?</p>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload