Welcome to the Question2Answer Q&A. There's also a demo if you just want to try it out.
0 votes
327 views
in Q2A Core by
edited by

I am redesigning (structure) the user page and got stuck because the Favorite Form contains the H1 and the input field for the favorite action.

<form method="post" action="../user/kajus">
  <h1>
  <span class="qa-favoriting" id="favoriting">
    <input name="favorite_U_9_0" onclick="return qa_favorite_click(this);" value="" class="qa-favorite-button" type="submit">
  </span>

Name

</h1>
<input name="code" value="securitycode" type="hidden">
</form>

This makes it very difficult to move the form or even moving the input field to another position does not work, since it is not in the form anymore.

My advice: Have the H1 standing alone (!) and the favorite form behind.

PS: And no, I cannot override function page_title_error() because I am using this function in many other plugins. And in this function we have:

            $this->output('<h1>');
            $this->favorite();
            $this->title();
            $this->output('</h1>');


Which causes the issue.

------

Update: Furthermore I cannot "touch" the *text* of h1 separately. The CSS always effects all elements within the H1.

---

I think it should be in qa-theme-base.php:

            $this->output('<h1>');
            $this->title();
            $this->output('</h1>');
            $this->favorite();

With an enclosing DIV around these elements.

Q2A version: 1.7.4
by
The ones who downvoted this post obviously never have done customization...
by
@Kai I think someone is testing Q2A and in that he is giving all of these downvotes. Maybe even one of them is @Knab who has done first comment on this question. See his profile, 40+ downvotes are there and he is only 6 hrs old user.
by
I thought it was spam.

1 Answer

+1 vote
by

A better solution would also make sure that the H1 is not within the form (also give the form a CSS class):

public function page_title_error()
{
    if (isset($this->content['title'])) {

        // q2apro changed order with favorite and put form down
        $this->output('<h1>');
        $this->title();
        $this->output('</h1>');
        
        $favorite = isset($this->content['favorite']) ? $this->content['favorite'] : null;
        
        if (isset($favorite))
            $this->output('<form class="favoriteform" ' . $favorite['form_tags'] . '>');

        $this->favorite();

        if (isset($favorite)) {
            $formhidden = isset($favorite['form_hidden']) ? $favorite['form_hidden'] : null;
            $this->form_hidden_elements($formhidden);
            $this->output('</form>');
        }
    }
    if (isset($this->content['error']))
        $this->error($this->content['error']);
}

...