Invision Community 4: SEO, prepare for v5 and dormant account notifications By Matt Monday at 02:04 PM
brandoninsc Posted December 23, 2022 Posted December 23, 2022 Can a block or Advertisement be added to a database entry, like an article, by inserting it into HTML? I can insert a google adsense script into html and it works, but I would rather insert a block or reference an Ad that I've set up directly in Invision. {block="my_block_key"} or {advertisement="KEY"}. Inserting these into the Source HTML editor does not work. Is there a way to make this work, or is there not an easy way to do in-content ads or embeds? Seems, that since this is a pretty standard use case, there has to be an easier way to do it than inserting the whole google script at each location, in each article. What would be even better, for a future feature, is to give the option to add advertisements to article content, not just forums. Claudia999 1
Solution Jim M Posted December 23, 2022 Solution Posted December 23, 2022 Template code cannot be inserted into the HTML editor, it has to be specifically in our PHTML templates (Pages templates, blocks, theme templates, etc...) to execute that. Theoretically, I suppose, you could create a custom PHP block with your advertisement custom location template code in it and then use the external embed code in your article. Here a guide on using blocks "externally", it will generate a Javascript code and HTML for you to embed where you want it: Alternatively, an approach which is a little more rigid but would automatically insert it into your articles, would be to include it in your Pages template for records. For something easier, I would suggest making your suggestion in our Feature Suggestion forum.
Recommended Posts