smarty templates should be depreciated (which I suspect will be the case), They serve little purpose, other that one more thing to maintain, and are much more limited and more roundabout than standard code.
Unfortunately I went on about separation for concern and template engines a couple years ago so, I feel partly responsible.
I quoted the wrong reply, I rejected your first answer at the time but that has come out to be the answer.
I ended up getting everything to work, however I don't know how to add in the whatever is the equivalent of {custom_menu}, I have also been receiving some weird behaviour when using certain plugins, with then being unable to find certain variable or constants that would work usually.
x00 said:
create a separate function rather than editing an existing one.
So if i created a seperate function and put it in the theme, would it work through there, or would the user have to move it to there /SmartyPlugins/ folder ?
Answers
check part of the profile.php, it contains this, maybe it helps you finding out how.
<?php if (!defined('APPLICATION')) exit(); if ($this->User->Photo != '') { if (StringBeginsWith($this->User->Photo, 'http')) echo Img($this->User->Photo); else echo Img(Gdn_Upload::Url(ChangeBasename($this->User->Photo, 'p%s'))); } else { echo "No Picture"; } ?>Where would I find this profile.php ? there are quite a few
oh sorry...i am a bit sleepy..., i ment views/profile/index.php
Mmm, can't get it in smarty though, and I don't want to change the template to php, it is too messy.
So I got it working by converting my template to php and using
include($this->FetchViewLocation('userphoto'));With the code you gave me in /views/discussions/userphoto however had to change $this to $Session.
However no have run into the problem of not being able to display link, as in Dashboard, discussions, activity, profile, inbox etc. etc.
I was using
< div class="Menu Box"> {signin_link} {dashboard_link} {discussions_link} {activity_link} {custom_menu} < /div> { if $User.SignedIn} < div class="ProfileMenu Box"> {profile_link} {inbox_link} {mydiscussions_link} {bookmarks_link} {drafts_link} {signinout_link} < /div> { /if}thanks for sharing!
-.- I already rejected that answer I am just going to accept this one
now i am confused
you mean you can't use these links because your theme is php now? When I get home I will get you the code for these, my theme is php
smarty templates should be depreciated (which I suspect will be the case), They serve little purpose, other that one more thing to maintain, and are much more limited and more roundabout than standard code.
Unfortunately I went on about separation for concern and template engines a couple years ago so, I feel partly responsible.
grep is your friend.
gnarrr! then i gotta rewrite mine soon
I quoted the wrong reply, I rejected your first answer at the time but that has come out to be the answer.
I ended up getting everything to work, however I don't know how to add in the whatever is the equivalent of {custom_menu}, I have also been receiving some weird behaviour when using certain plugins, with then being unable to find certain variable or constants that would work usually.
try this:
<?php $Session = Gdn::Session(); if ($this->Menu) { $this->Menu->AddLink('Dashboard', T('Dashboard'), '/dashboard/settings', array('Garden.Settings.Manage')); //$this->Menu->AddLink('Dashboard', T('Users'), '/user/browse', array('Garden.Users.Add', 'Garden.Users.Edit', 'Garden.Users.Delete')); $this->Menu->AddLink('Activity', T('Activity'), '/activity'); if ($Session->IsValid()) { $Name = $Session->User->Name; $CountNotifications = $Session->User->CountNotifications; if (is_numeric($CountNotifications) && $CountNotifications > 0) $Name .= ' < span class="Alert">'.$CountNotifications.'< /span>'; if (urlencode($Session->User->Name) == $Session->User->Name) $ProfileSlug = $Session->User->Name; else $ProfileSlug = $Session->UserID.'/'.urlencode($Session->User->Name); $this->Menu->AddLink('User', $Name, '/profile/'.$ProfileSlug, array('Garden.SignIn.Allow'), array('class' => 'UserNotifications')); $this->Menu->AddLink('SignOut', T('Sign Out'), SignOutUrl(), FALSE, array('class' => 'NonTab SignOut')); } else { $Attribs = array(); if (SignInPopup() && strpos(Gdn::Request()->Url(), 'entry') === FALSE) $Attribs['class'] = 'SignInPopup'; $this->Menu->AddLink('Entry', T('Sign In'), SignInUrl($this->SelfUrl), FALSE, array('class' => 'NonTab'), $Attribs); } echo $this->Menu->ToString(); } ?>That looks very much familiar to the code I copied my code from.
It's probably standard in php themes...
That's where I pulled it from :P
easier edit function.photo_link.php at vanilla\library\vendors\SmartyPlugins. I just found it @_@
And if you want to add custom, try working with smartyplugins
yeah, couldn't do that though because I was working on a theme to distribute which would require others to also have to make the alterations.
create a separate function rather than editing an existing one.
grep is your friend.
So if i created a seperate function and put it in the theme, would it work through there, or would the user have to move it to there /SmartyPlugins/ folder ?