25 Mar 2017

How to fix T3 template options displaying the full path in the layout field

Here's a weird bug that I have identified from time to time. In the template options of T3, the layout field is displaying the full path to each laout option, rather than display each layout name.

 

For me, I identified this when installing a site on my local wamp, from a backup. It's worth mentioning that the Joomla version is 3.6.X

How to fix T3 template options displaying the full path in the layout field

The fix to this does involve a hack to core files, which I normally would not recommend, but I am yet to find a better solution. Writing to the core files hasn't been a deal breaker for me in this instance, as this problem has only been noticed on my local wamp and not on a live site, and I haven't had the need to push my hack up to the live site - So for the moment, making a hack to my local version has solved the problem.

As yet, I haven't seen if the problem still exists once the version of Joomla has been updated - Nor can I say with any certainty that this issue only exists with Joomla 3.6.X (but that has been my experience).

Ok - On with the fix. Remove the lines on code in red, and insert the lines in green.

plugins/system/t3/includes/depend/t3filelist.php

 
    // update path to this template
    $path = (string) $this->element['directory'];
    + $path = JPath::clean($path);
    $options = array();
    // get files in template path
    $this->directory = $this->element['directory'] = T3_TEMPLATE_PATH . DIRECTORY_SEPARATOR . $path;

 

plugins/system/t3/includes/depend/t3folderlist.php

    $paths = T3Path::getAllPath ($path);
    foreach ($paths as $path) {
    - $this->directory = $this->element['directory'] = $path;
    + $this->directory = $this->element['directory'] = JPath::clean($path);
    $tmps = parent::getOptions();
    foreach ($tmps as $tmp) {
    if (in_array($tmp->value, $vals)) continue;