Recent Topics

1 Oct 16, 2014 15:46    

Ver 5.0.9

Many version ago, 2.4, I could format the titles so that important pages/posts tile would be hightlighted (in post listing etc. too) strong but since then such formatting comes out in the title as html <strong>Some Title</strong>

Any ideas on how to get the formatting to format and not do an html on me?

Thanks

2 17 Oct 2014 18:23

Hi @amoun,

Back in the day, that was a bug not a feature. Not really, I'm joking :D

Using HTML code in posts titles is completely discouraged, because of that, everything is escaped before to be saved in the database, and that's also the reason why you get the tags exactly as you wrote them and not interpreted by the browser.

In order to revert that, you must hack the core. Do you really need it?

3 19 Oct 2014 18:36

Updated to 5.1.2

No, but I would like it, maybe I'll leave it, on the other hand do you know where the escape is applied so I can see how it works?

Thank you

4 20 Oct 2014 19:40

All right, I recommend you to use a regular expression to filter the tags allowed in the title. In any case, the instruction that you need to modify is in the file: inc/items/model/_item.class.php ( line 738 in v5.1.2 ).

Original instruction:


param( 'post_title', 'htmlspecialchars', NULL );

Replacement to allow any html tag in the title:


param( 'post_title', 'html', NULL );

Replacement to allow only <b> and <strong> tags wrapping the title ( any other entry will produce a debug_die error ):


param( 'post_title', '/^<(b|strong)>(.*)<\\/\\1>$/i', NULL );

Regards!


Form is loading...