View Single Post
  #69  
Old 11-22-2005, 12:39 PM
dodgechargerfan dodgechargerfan is offline
 
Join Date: Aug 2005
Posts: 94
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Quote:
Is there a way to have the name of the file show up as a tooltip when a user hovers their mouse over the picture. It would be great if you could parse out the prefix and file extension too.

With this new idea, I'd like to have the filenames represent the user that owns the car. That way, when someone hovers over the picture, they get a tooltip that tells who owns the car...
Some hacking and slashin and I was able to get this aspect working.

I'm not sure how valuable it is to everyone else, but it at least serves as an example of some changes that can be added.

I'll leave it to jugo to decide if it should be added to the product.

For the record, I got the parsing code from an example in the PHP online manual and adjusted things to suit my needs.

I added a function and a couple of working variables at the top of the PHP code in the xml file:
Code:
function remover($string, $sep1, $sep2)
{
       $string = substr($string, 0, strpos($string,$sep2));
       $string = substr(strstr($string, $sep1), strlen($sep1));

       return $string;
}

$str1 = $vbulletin->options['randimg_delim'];
$str2 = ".jpg";
This function strips out text from a string based on characters that surround the text that you want.
Sending "some text (a note) some more text" with "(" and ")" as $sep1 and $sep2 would return "a note".
I added in the strlen call so that it would strip out whatever is used for the delimiter.

And then I use another variable and assign the results of the function to it.
Then the variable gets used in the building of the value for randpic# which is the variable that you can then use anywhere you want the picture to show up.
Code:
$randpic1 = $imgurl.$files[$rand1];
$alt1 = remover($randpic1, $str1, $str2);
$randpic1 = "<img src=\"".$randpic1."\" border=\"0\" alt=\"".$alt1."\" />";
The end result: when you hover your mouse over the picture, the tooltip that comes up is the image filename without the banner delimiter prefix and the file extension.

The only trick to this is to make sure that whatever you use for the banner prefix delimiter, it should be unique in the entire url of the file. Otherwise the remover function will stop on the first instance of the delimiter and you'll get whatever is left of the url as a tooltip.

So, using "banner" as your delimiter wouldn't work if you put all of your files in a directory called banner.....

"/images/banner/bannerimage1.jpg" would give you "/bannerimage1" as the alt text... not really a problem, but that's not what I was after. I wanted to see "image1" come up.

You could easily solve this by adding another character in the file name after banner and making that your delimiter.

"/images/banner/bannertimage1.jpg" and a delimiter of "bannert" would work just fine.

Thanks again to jugo for the great work.

I would not have been able to get this banner thing working without the headstart that his product provided.
Reply With Quote
 
X vBulletin 3.8.12 by vBS Debug Information
  • Page Generation 0.01642 seconds
  • Memory Usage 1,776KB
  • Queries Executed 11 (?)
More Information
Template Usage:
  • (1)SHOWTHREAD_SHOWPOST
  • (1)ad_footer_end
  • (1)ad_footer_start
  • (1)ad_header_end
  • (1)ad_header_logo
  • (1)ad_navbar_below
  • (2)bbcode_code
  • (1)bbcode_quote
  • (1)footer
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (6)option
  • (1)post_thanks_box
  • (1)post_thanks_button
  • (1)post_thanks_javascript
  • (1)post_thanks_navbar_search
  • (1)post_thanks_postbit_info
  • (1)postbit
  • (1)postbit_onlinestatus
  • (1)postbit_wrapper
  • (1)spacer_close
  • (1)spacer_open 

Phrase Groups Available:
  • global
  • postbit
  • reputationlevel
  • showthread
Included Files:
  • ./showpost.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/functions_bigthree.php
  • ./includes/class_postbit.php
  • ./includes/class_bbcode.php
  • ./includes/functions_reputation.php
  • ./includes/functions_post_thanks.php 

Hooks Called:
  • init_startup
  • init_startup_session_setup_start
  • init_startup_session_setup_complete
  • cache_permissions
  • fetch_postinfo_query
  • fetch_postinfo
  • fetch_threadinfo_query
  • fetch_threadinfo
  • fetch_foruminfo
  • style_fetch
  • cache_templates
  • global_start
  • parse_templates
  • global_setup_complete
  • showpost_start
  • bbcode_fetch_tags
  • bbcode_create
  • postbit_factory
  • showpost_post
  • postbit_display_start
  • post_thanks_function_post_thanks_off_start
  • post_thanks_function_post_thanks_off_end
  • post_thanks_function_fetch_thanks_start
  • post_thanks_function_fetch_thanks_end
  • post_thanks_function_thanked_already_start
  • post_thanks_function_thanked_already_end
  • fetch_musername
  • postbit_imicons
  • bbcode_parse_start
  • bbcode_parse_complete_precache
  • bbcode_parse_complete
  • postbit_display_complete
  • post_thanks_function_can_thank_this_post_start
  • showpost_complete