$this->link() Change

Feed 2 posts, 2 voices

Aug 17, 2008 05:28
Avatar
315 posts

I found that, since I was using HTML tags in my titles e.g. <i> </i> tags for emphasis, I would really appreciate the tags not showing up in the title= tag of a link that $this->link() creates. I edited trunk\frog\app\frontend\classes\Page.php like so:

    public function link($label=null, $options='')
    {
        if ($label == null)
            $label = $this->title();

        return sprintf('<a href="%s" title="%s" %s>%s</a>',
               $this->url(),
               $this->title(),
               $options,
               $label
        );
    }

And changed it to:

    public function link($label=null, $options='')
    {
        if ($label == null)
            $label = $this->title();

        return sprintf('<a href="%s" title="%s" %s>%s</a>',
               $this->url(),
               strip_tags($this->title()),
               $options,
               $label
        );
    }

The specific change in there is:

               $this->title(),

Becomes:

               strip_tags($this->title()),

Hope that helps someone.

 
Aug 17, 2008 11:14
Avatar
458 posts

@mtylerb - this should be considered an issue... I've added a defect to Frog's issue tracking system.

HTML code should not be placed in a page's title attribute. These kind of things should be placed in the layout.

 
Aug 17, 2008 16:35
Avatar
315 posts

I wasn't sure, thanks for letting me know, I decided I'd just post what I had found.