Vanilla 1 is no longer supported or maintained. If you need a copy, you can get it here.
HackerOne users: Testing against this community violates our program's Terms of Service and will result in your bounty being denied.
Options

I want to ad links into the Description part of the category, how to?

edited February 2008 in Vanilla 1.0 Help
How can i make/ ad links into the description part of the category? It says html not allowed... thanks, wayne

Comments

  • Options
    which I think means you can't... ... I suppose you could add links near to the description by making your own theme for the categories pane.
  • Options
    It really wouldn't matter if i could get the sub-categories ext to work, but it they don't show up in the categories section :( ..
  • Options
    There's gotta be a way to allow html into the categories...
  • Options
    There was an add-on called CategoryColorChanger which could be modified to do what you want. How would you tell the add-on what words to convert to a link (to something)?
  • Options
    I dunno :P but i'm willing to give it a try
  • Options
    You could find out which bit of code strips out the HTML and kill it!

    I've done it before but found other solutions, I don't like hacking the core files unless it's absolutely necessary.

    Posted: Saturday, 10 November 2007 at 11:32AM

  • Options
    @wanderer what do you mean by "but found other solutions"? other solutions for enabling html into category description without hacking core files? thanks for clarifying ;)
  • Options
    Miquel, I said that last November mate, I can't remember what I had for breakfast this morning!
    Sorry, no idea what I meant. pic
  • Options
    You could edit the category description with something else, like PHPMyAdmin.
  • Options
    edited February 2008
    The issue is that when categories are saved, the code runs the strip_tags() function, which removes any text encased in < > brackets.

    One way you could get around this would be to write your link with a substitute string, such as normal brackets [ ]. So a link would look like:

    ... [a href="mysite.com"]mysite[/a] ...

    Then, inside the categories theme file, you add a str_replace() that replaces the substitute string for the real < > brackets.

    [ln 17] $Category->FormatPropertiesForDisplay(); str_replace('[', '<', $Category->Description); str_replace(']', '>', $Category->Description);
  • Options
    OK thanks, I'll give it a try!
  • Options
    timfire your idea works nicely, thanks ;) but I dunno why, Vanilla sets the link as: http://localhost/xampp/Vanilla-1.1.4/"http://www.mysite.com" so I can't manage it to really work. any idea of why is happening this?
  • Options
    edited February 2008
    What address are you using inside the <a> tag, "mysite.com" or "http://www.mysite.com"? Are you saying Vanilla is adding "http://localhost/xampp/Vanilla-1.1.4/" (the site root, I assume) to the URL you're providing inside the <a> tag?

    I'm not sure why it would add the site root. I guess I could look a bit deeper into the code...
  • Options
    inside the tag I write the full url "http://www.mysite.com" and yes, Vanilla is adding its root path to the link
  • Options
    edited February 2008
    OK, I'm not 100% sure, but $Category->FormatPropertiesForDisplay() calls the htmlspecialchars() function, and I think that's what is causing the current issue. It's changing the double quotes so that the browser doesn't recognize the URL as a URL. So the browser is being given a functionally empty <a> tag, and that's why it's adding the site root... At least I think that's what is happening.

    Try changing your substitution string inside the categories description to something that doesn't include quotes:
    ... [a href=*http://www.mysite.com*]mysite[/a] ...

    Then change the categories theme file appropriately:
    [ln 17] $Category->FormatPropertiesForDisplay(); str_replace('[a href=*', '<a href="', $Category->Description); str_replace('*]', '">', $Category->Description); str_replace('[/a]', '</a>', $Category->Description);
  • Options
    thanks a lot timfire ;)
This discussion has been closed.