Go Back   vb.org Archive > vBulletin 3 Discussion > vB3 Programming Discussions
  #1  
Old 02-14-2008, 09:59 PM
dartho dartho is offline
 
Join Date: Sep 2005
Location: Australia
Posts: 2,303
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default Plugin Help - str_replace ?

I'm still a novice, that's why I'm asking here!

I'd like to create a plugin that will do a simple string replace on the "<HTML>" tag on ALL pages.

I want to replace <html ......>

with <html id=blah ......>

I have previously done a search and replace on all templates, but thought a plugin would be nicer - I try not to manually edit any templates.

Any help appreciated - thanks
Reply With Quote
  #2  
Old 02-14-2008, 10:02 PM
Eikinskjaldi's Avatar
Eikinskjaldi Eikinskjaldi is offline
 
Join Date: Feb 2006
Location: Hell, never looked better
Posts: 572
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Templates are called with the fetch_template function, have a look in that. It probably lives in functions.php or bigthree, I don't have vb handy to check.
Reply With Quote
  #3  
Old 02-14-2008, 10:06 PM
Boofo's Avatar
Boofo Boofo is offline
 
Join Date: Mar 2002
Location: Des Moines, IA (USA)
Posts: 15,776
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Wouldn't that already be parsed at that point?
Reply With Quote
  #4  
Old 02-14-2008, 10:25 PM
cheesegrits's Avatar
cheesegrits cheesegrits is offline
 
Join Date: May 2006
Posts: 500
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

It'd might easier to do this with a little bit of javascript in the headinclude template (or add it to $headinclude in a plugin like global_start).

Something like this might do it ...

HTML Code:
<script type="text/javascript">
<!--
window.addEvent('domready', function () {
    document.getElementsByTagName('html')[0].setAttribute('id','blah');
});
-->
</script>
-- hugh
Reply With Quote
  #5  
Old 02-15-2008, 08:26 AM
dartho dartho is offline
 
Join Date: Sep 2005
Location: Australia
Posts: 2,303
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

No joy with this - i'm thinking old fashioned search and replace may be easiest...

Thanks for the suggestions!
Reply With Quote
  #6  
Old 02-15-2008, 02:26 PM
cheesegrits's Avatar
cheesegrits cheesegrits is offline
 
Join Date: May 2006
Posts: 500
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Ooops, my apologies, I've been coding with Mootools for too long, keep forgetting vB doesn't use it! So window.addEvent() doesn't exist.

Don't really need it tho. Just do this somewhere in headinclude:

HTML Code:
<script type="text/javascript">
<!--
document.getElementsByTagName('html')[0].setAttribute('id','blah');
-->
</script>
I just tested it, and it works fine:

HTML Code:
<html id="blah" lang="en" dir="ltr" xmlns="http://www.w3.org/1999/xhtml">
NOTE - if you just 'View Source", you won't see the change to the html tag. Show source only shows you the page as it was loaded from the server, it doesn't show you any modifications made to the DOM by any JavaScript. You need to run something like FireBug in FireFox to see the modified DOM structure, and use FireBug to "Inspect" the HTML. Then you'll see the modified DOM.

(DOM is the Document Object Model, the actual structure of your page within the browser)

-- hugh
Reply With Quote
  #7  
Old 02-15-2008, 11:08 PM
dartho dartho is offline
 
Join Date: Sep 2005
Location: Australia
Posts: 2,303
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Will test this out later - thanks. Wonder how Google and the link will see it? I'm testing a theory that google uses ID tags when ranking keywords and thinking this may be yet another SEO helper ...
Reply With Quote
Reply

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT. The time now is 10:53 PM.


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.07036 seconds
  • Memory Usage 2,210KB
  • Queries Executed 11 (?)
More Information
Template Usage:
  • (1)SHOWTHREAD
  • (1)ad_footer_end
  • (1)ad_footer_start
  • (1)ad_header_end
  • (1)ad_header_logo
  • (1)ad_navbar_below
  • (1)ad_showthread_beforeqr
  • (1)ad_showthread_firstpost
  • (1)ad_showthread_firstpost_sig
  • (1)ad_showthread_firstpost_start
  • (3)bbcode_html
  • (1)footer
  • (1)forumjump
  • (1)forumrules
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (1)navbar
  • (3)navbar_link
  • (120)option
  • (7)post_thanks_box
  • (7)post_thanks_button
  • (1)post_thanks_javascript
  • (1)post_thanks_navbar_search
  • (7)post_thanks_postbit_info
  • (7)postbit
  • (7)postbit_onlinestatus
  • (7)postbit_wrapper
  • (1)spacer_close
  • (1)spacer_open
  • (1)tagbit_wrapper 

Phrase Groups Available:
  • global
  • inlinemod
  • postbit
  • posting
  • reputationlevel
  • showthread
Included Files:
  • ./showthread.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_threadinfo_query
  • fetch_threadinfo
  • fetch_foruminfo
  • style_fetch
  • cache_templates
  • global_start
  • parse_templates
  • global_setup_complete
  • showthread_start
  • showthread_getinfo
  • forumjump
  • showthread_post_start
  • showthread_query_postids
  • showthread_query
  • bbcode_fetch_tags
  • bbcode_create
  • showthread_postbit_create
  • postbit_factory
  • 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
  • tag_fetchbit_complete
  • forumrules
  • navbits
  • navbits_complete
  • showthread_complete