Welcome to the Question2Answer Q&A. There's also a demo if you just want to try it out.
+3 votes
416 views
in Themes by

I want to have instead of a star icon an "Add question to my favorites" and "add tag to my favorites" text buttons.
theorically this is very simple. in the theme file i overrided the function :
 

function favorite_button($tags, $class)
        {
            if (isset($tags))
            {
                if ($class=="qa-favorite"){
 
                    $this->output('<input '.$tags.' type="submit" value=""" class="'.$class.'-button"/> ');
                }else{
                    $this->output('<input '.$tags.' type="submit" value="" class="'.$class.'-button"/> ');
                }
            }
        }
 
with this one ( changes in red )
 
function favorite_button($tags, $class)
        {
            if (isset($tags))
            {
                if ($class=="qa-favorite"){
 
                    if( $this->template=='question')
                    $this->output('<input '.$tags.' type="submit" value="add question to my favourite" class="'.$class.'-button"/> ');
 
                   if ($this->template=='tag')
                    $this->output('<input '.$tags.' type="submit" value="add tag my favourite" class="'.$class.'-button"/> ');
                }else{
                    $this->output('<input '.$tags.' type="submit" value="added" class="'.$class.'-button"/> ');
                }
            }
        }
 
it seems very logic and it works ! 
But strangely when you press the favorite question button and press it again to unfavorite , the button disapears !. that's mean that the $this->template variable is no longer set after the ajax request. how comes ? how can this be solved ?


Thank you in advance !

 
 
 

 

Please log in or register to answer this question.

...