vb.org Archive

vb.org Archive (https://vborg.vbsupport.ru/index.php)
-   vB3 Design and Graphics Discussions (https://vborg.vbsupport.ru/forumdisplay.php?f=168)
-   -   Need help with this (https://vborg.vbsupport.ru/showthread.php?t=196935)

veenuisthebest 11-22-2008 12:44 PM

Need help with this
 
Hii,

I used HTML in Forum title field to display a image. (I must use it in title and not in description). Say I used this code:-

HTML Code:

<img src="images/forumlogos/8.gif" align="left" border="0" alt="" hspace="5" />Forum title

It works just perfect and I am able to achieve what i want. BUT one thing I don't like is that the image is even displaying in the category strip (in the tcat) while viewing that forum, which is stretching it and making it look very bad.

SO, how do I block the HTML part to show in the tcat? and allow only the text i.e. Forum title. There's got to be some way to do it.

Thank you

ReCom 11-22-2008 01:01 PM

How about using plugin to inject the img tag into the output instead of inserting the tag in forum title? Or even customize the specific forum listing template. That way the image will appear exactly where you want it to be instead of wherever the forum title is displayed (one can never know all the places the forum title is displayed -- archives, RSS, thread subscription emails? *shivers*) ...

veenuisthebest 11-22-2008 01:25 PM

Thanks for your reply recom!

But I need more info please. Give me some idea of how the plugin code would look like and what hooks to use, i am new to this!

Thanks

ReCom 11-22-2008 01:46 PM

Add a plugin with hook location: forumbit_display

The code:
Code:

$forum['title'] = '<img src="images/forumlogos/'.$forum['forumid'].'.gif" onerror="this.style.display=\'none\';" /> '.$forum['title'];
Save the plugin.

Then upload the forum logos into your images/forumlogos directory, with each logo named after the forumid (e.g. if the forumid is 18 then the logo is named 18.gif)

Set the plugin as active.

(the img tag I included above is special since it automatically handles situations where the logo files are missing by hiding itself)

veenuisthebest 11-22-2008 02:35 PM

thanks, but I could achieve exactly the same thing editing forumhome_forumbit_level2_post template. But plugin thing saved my edit ;)

I'm getting xhtml validation errors with onerror attribute. And the img tag still exists for all forums where logo files are missing. How do I stop injecting img tag on forums that does not have logo file?

Thanks

--------------- Added [DATE]1227379492[/DATE] at [TIME]1227379492[/TIME] ---------------

alright, I checked for existence of file this way.

PHP Code:

$filename 'images/forumlogos/'$forum[forumid].'.gif';

if (
file_exists($filename)) {
$forum['title'] = '<img src="images/forumlogos/'.$forum['forumid'].'.gif" /> '.$forum['title'];


Thanks


All times are GMT. The time now is 01:02 AM.

Powered by vBulletin® Version 3.8.12 by vBS
Copyright ©2000 - 2025, vBulletin Solutions Inc.

X vBulletin 3.8.12 by vBS Debug Information
  • Page Generation 0.01023 seconds
  • Memory Usage 1,723KB
  • Queries Executed 10 (?)
More Information
Template Usage:
  • (1)ad_footer_end
  • (1)ad_footer_start
  • (1)ad_header_end
  • (1)ad_header_logo
  • (1)ad_navbar_below
  • (1)bbcode_code_printable
  • (1)bbcode_html_printable
  • (1)bbcode_php_printable
  • (1)footer
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (6)option
  • (1)post_thanks_navbar_search
  • (1)printthread
  • (5)printthreadbit
  • (1)spacer_close
  • (1)spacer_open 

Phrase Groups Available:
  • global
  • postbit
  • showthread
Included Files:
  • ./printthread.php
  • ./global.php
  • ./includes/init.php
  • ./includes/class_core.php
  • ./includes/config.php
  • ./includes/functions.php
  • ./includes/class_hook.php
  • ./includes/modsystem_functions.php
  • ./includes/class_bbcode_alt.php
  • ./includes/class_bbcode.php
  • ./includes/functions_bigthree.php 

Hooks Called:
  • init_startup
  • init_startup_session_setup_start
  • init_startup_session_setup_complete
  • cache_permissions
  • fetch_threadinfo_query
  • fetch_threadinfo
  • fetch_foruminfo
  • style_fetch
  • cache_templates
  • global_start
  • parse_templates
  • global_setup_complete
  • printthread_start
  • bbcode_fetch_tags
  • bbcode_create
  • bbcode_parse_start
  • bbcode_parse_complete_precache
  • bbcode_parse_complete
  • printthread_post
  • printthread_complete