Path Update issue in $this->getThemePath() (Possible bug?)

Permalink 1 user found helpful
Just updated a site in developement to 5.6.0.2, and everything went swimmingly, just up until today. I added a new theme to the site to add some variance (the templates are totally different to the main theme and will develop differently)

The main theme seems to process
<img src="<?php echo $this->getThemePath(); ?>/img/logo.jpg" width="277" height="102" />

correctly, and renders the above as
/themes/theme1/img/logo.jpg

where "theme1" is the main theme of the site.

However, on a page using a template in the NEW theme, the very same structure
<img src="<?php echo $this->getThemePath(); ?>/img/logo2.jpg" width="277" height="102" />

renders
/updates/concrete5.6.0.2/concrete/themes/theme2/img/logo2.jpg

where "theme2" is the newer theme.

It seems to be appending the update path (which is correctly used for the C5 furniture in BOTH themes) to the theme-relative path that is being returned by $this->getThemePath().

I tried using the view instance with
$v = View::getInstance();
 $view=$v->getThemePath();


but $view contains exactly the same path as $this->getThemePath(). Anybody seen this? It's a little urgent as this site was due to go live tomorrow, and i'll have to hack in some hardcoding (which i hate) until I can dive into the core and get to the bottom of it!

Thanks in advance!

shrike71

 
JeffPaetkau replied on at Permalink Reply
JeffPaetkau
I am having the same issue. Did you find a resolution?
shrike71 replied on at Permalink Reply
Nope. Opted to create a properties file and put the theme specific paths hardcoded into categories and load them into the template. Not ideal, i know, but it was the best I could come up with at short notice... i've a feeling this might be a bug, so it'll definitely need to be addressed at some point

Shrike71
hrcv replied on at Permalink Reply
hrcv
I'm Getting the same problem here!

<?php echo $this->getThemePath(); ?>

Returns: /concrete/themes/ ....

And it should be: /themes/ ...
akuma6099 replied on at Permalink Reply
I have a fresh installation doing a similar thing.

$this->inc('elements/header.php');
Returns" "/concrete/themes/zenlike/"

$this->getThemePath();
Returns: "/themes/zenlike/"

Had to: include($this->getThemePath() . '/elements/header.php');

EDIT:
I figured out my issue. Even tho I had created an EMPTY site, there are pages like Edit, Avatar, and Messages that utilize view.php. I noticed this when I couldn't delete the default page type of Right_Sidebar even tho I only had 1 home page set to the Full page type. The theme I created only had the default.php. After activating my theme and trying to visit the Profile->Edit page through site map, I received the missing "/concrete/themes/zenlike/elements/header.php" message. I simply copied my default.php to view.php and adjusted the content to "print $innerContent" instead of the usual $a = new Area("some area"); and the Edit page showed up without error. As stated in the documentation, View.php is required just like Default.php. I would also add full.php to this list cause when you activate the new theme, other pages probably have that default named page type associated.
mikelaye replied on at Permalink Reply
Yep, that's the issue!

I thought at first this above comment had got mis-posted from another thread but, no, it is correct, however odd that seems. Whatever templates you're actually using in your theme, you *must* have a 'view.php' and a 'default.php' there, otherwise getThemePath() will not return the correct path. (I got the full site path with an extra, unwanted "/concrete" in - it was all correct, except for that, which was breaking it)

Took most of this afternoon to get there, but that's fixed it. Don't remember this from previous versions, but it's definitely the case in v5.6.0.2

Hope that helps somebody ...
rainmaker replied on at Permalink Reply
rainmaker
You guys helped me! :D I usually forget a view & default and always got the error. Guess we aren't getting those anymore. :'(