Go Back   vb.org Archive > vBulletin Modifications > vBulletin 3.8 Modifications > vBulletin 3.8 Add-ons
FAQ Community Calendar Today's Posts Search

Reply
 
Thread Tools
Accelerated Mobile Pages for vBulletin Details »»
Accelerated Mobile Pages for vBulletin
Version: 1.00, by NeutralizeR NeutralizeR is offline
Developer Last Online: Oct 2021 Show Printable Version Email this Page

Category: Integration with vBulletin - Version: 3.8.x Rating:
Released: 10-19-2016 Last Update: 10-19-2016 Installs: 17
Template Edits
Re-useable Code Code Changes Additional Files Translations  
No support by the author.

What is AMP?
https://www.ampproject.org/

Info
When Google announced AMP, I realized I'd eventually need AMP support for my vBulletin forum. After reading the AMP implementation docs, I decided to modify printthread.php file since It only displays the basic elements and contents of a thread. So, you got the idea...

Implementation
  1. You will upload 1 file to forum root: amp.php
  2. You will edit /includes/class_bbcode.php and edit/replace a few lines.
  3. You will add two new templates, and edit a few.
  4. You will probably want to customize the <style amp-custom> CSS in ampthread template.
Demo
  1. Visit any thread from https://www.msxlabs.org homepage.
  2. Scroll down to footer; you will see the AMP link at the left bottom corner, click on it. It will open the AMP version of the thread.
  3. The link is there for quick access to AMP version of a thread, It is not mandatory, nor It is used by AMP recognation.
Installation
  1. Download and extract the ZIP file.
  2. Upload the amp.php file to your forum root folder (same folder with showthread.php)
  3. Add a new template called "ampthread" and copy the template content from ampthread_template.txt file.
  4. Add a new template called "ampthreadbit" and copy the template content from ampthreadbit_template.txt file.
  5. Edit your bbcode_quote template and replace It's content with bbcode_quote.txt file's.
  6. Edit includes/class_bbcode.php, find:
    PHP Code:
    if ($do_imgcode AND ($this->registry->userinfo['userid'] == OR $this->registry->userinfo['showimages'])) 
    replace with:
    PHP Code:
    if ($do_imgcode AND ($this->registry->userinfo['userid'] == OR $this->registry->userinfo['showimages']) OR THIS_SCRIPT == 'amp'//amp hack 
    find:
    PHP Code:
    return '<img src="' .  $link '" border="0" alt="" />'
    replace with:
    Code:
    if (THIS_SCRIPT == 'amp') {    return '<amp-img layout="responsive" src="' .  $link . '" width="300" height="250" alt=""></amp-img>';}    else { return '<img src="' .  $link . '" border="0" alt="" />';    } //amp hack
  7. Save and upload class_bbcode.php (overwrite).
  8. Edit SHOWTHREAD template and add
    Code:
    <link rel="amphtml" href="http://www.vbulletin.com/amp.php?t=$threadid<if condition="$pagenumber>1">&amp;page=$pagenumber</if>" />
    before </head>. Don't forget to change "yourforum.com" URL with yours.
  9. Edit ampthread template and change "vbulletin.com" with your forum URL:
    Code:
    <link rel="canonical" href="http://www.vbulletin.com/showthread.php?t=$threadinfo[threadid]<if condition="$pagenumber>1">&page=$pagenumber</if>" />
  10. You will find some comments in amp.php and ampthread template; modify them according to your needs (optional).
Notes
I installed a fresh vBulletin 3.8 to my localhost and tested this mod. It should work just fine unless your vBulletin is highly modified. If you get validation errors, I believe you can fix them by looking at the examples (comments).


Does it work?

  1. Open a thread from your forum.
  2. Replace the "showthread.php" with "amp.php" in the address bar, hit enter.
  3. Add "#development=1" at the end of the URL and refresh the page.
  4. Open Chrome DevTools, check the console log, it should say "AMP validation successful."
Screenshots
Snap2.png

Snap3.png

Snap4.png

Snap5.png

Credits
Accelerated Mobile Pages for vBulletin 3.8 is created by NeutralizeR from https://www.msxlabs.org

Download Now

File Type: zip AMP for vBulletin by MsXLabs.org v1.0.zip (8.2 KB, 264 views)

Show Your Support

  • This modification may not be copied, reproduced or published elsewhere without author's permission.
12 благодарности(ей) от:
A.Chakery, Abu1, blind-eddie, bond010007, Brandon Sheley, Kane@airrifle, LeventX, m7sen, Masterix, Nas.er, PinkMilk, z3r0

Comments
  #32  
Old 11-04-2016, 08:15 PM
nw-fotografie nw-fotografie is offline
 
Join Date: Mar 2016
Posts: 28
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Great job! Thanks a lot!

Quote:
Originally Posted by NeutralizeR View Post
Helped via PM.

Note: I can't answer all questions via PM but I'll try to help you fix the validation issues. I believe we covered most of them. Some plugins globally add codes/lines to many vB pages, including AMP. You should exclude them for AMP threads.
Reply With Quote
  #33  
Old 11-05-2016, 06:53 AM
Masterix Masterix is offline
 
Join Date: Jan 2008
Posts: 16
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Quote:
Originally Posted by NeutralizeR View Post
You don't actually need to rewrite AMP pages. AMP pages will be served by Google once they are crawled.
[...]
Thats right but you need to change your vBSEO-settings to get AMPlike-URLs
See there https://vborg.vbsupport.ru/showpost....6&postcount=13

Thanks again for your top Addon ! :up:
Reply With Quote
Благодарность от:
NeutralizeR
  #34  
Old 11-05-2016, 12:56 PM
unp unp is offline
 
Join Date: Oct 2008
Posts: 54
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Kindly share if anyone use and figure how to disable ame on amp pages.

https://vborg.vbsupport.ru/showthread.php?t=303416

or a possible alternative to ame.
Reply With Quote
  #35  
Old 11-07-2016, 01:18 PM
NeutralizeR NeutralizeR is offline
 
Join Date: Aug 2005
Posts: 355
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Quote:
Originally Posted by unp View Post
Kindly share if anyone use and figure how to disable ame on amp pages.

https://vborg.vbsupport.ru/showthread.php?t=303416

or a possible alternative to ame.
Check these pages:
https://www.ampproject.org/docs/guides/amp_replacements
https://www.ampproject.org/docs/guides/iframes

Check the preg_replace examples in the amp.php file.
Code:
//Remove&Replace stuff for AMP validation
Reply With Quote
  #36  
Old 01-09-2017, 10:16 PM
citeman citeman is offline
 
Join Date: Feb 2008
Posts: 22
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Hi NeutralizeR, Thanks for this incredible mod to get AMP threads going.

I am however unable to get the url structure of the AMP threads to be like yours - .org/forum/amp/249347.html.

Adding the VBSEO custom rewrite rule:

Code:
'^amp\.php\?t=(\d+)&page=(\d+)$' => 'amp/$1-$2.html'
Is giving an error when I try to load the rewritten URL. Am I missing something here?
Reply With Quote
  #37  
Old 01-29-2017, 06:58 PM
Emad ELsayed's Avatar
Emad ELsayed Emad ELsayed is offline
 
Join Date: Feb 2013
Posts: 173
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Hello dear
Thank you very much for the featured product
Installation was successfully 3.8.10
Please check my site and whether everything is fine

http://www.lover3moon.com/vb/showthread.php?t=184366
http://www.lover3moon.com/vb/amp.php?t=184366

I have error when checking link
https://validator.ampproject.org/#ur...p%3Ft%3D184366

Best regards
Reply With Quote
  #38  
Old 01-31-2017, 12:58 PM
carlosacgj carlosacgj is offline
 
Join Date: Apr 2006
Posts: 45
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Quote:
Originally Posted by Emad ELsayed View Post
Hello dear
Thank you very much for the featured product
Installation was successfully 3.8.10
Please check my site and whether everything is fine

http://www.lover3moon.com/vb/showthread.php?t=184366
http://www.lover3moon.com/vb/amp.php?t=184366

I have error when checking link
https://validator.ampproject.org/#ur...p%3Ft%3D184366

Best regards
I have the same validation problems and I thought that only happened to me ....
Reply With Quote
  #39  
Old 03-19-2017, 06:57 PM
dr-php dr-php is offline
 
Join Date: Sep 2007
Posts: 4
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Hello,

plugin not working with me

we show blank page on visit any post included amp

example :

http://www.amalh.net/test/amp.php?t=1
Reply With Quote
  #40  
Old 05-10-2017, 10:33 PM
hosamalzagh hosamalzagh is offline
 
Join Date: Oct 2015
Posts: 5
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Quote:
Originally Posted by carlosacgj View Post
I have the same validation problems and I thought that only happened to me ....
i can repair all error for 50$
Reply With Quote
  #41  
Old 06-08-2017, 03:27 PM
FelipeB FelipeB is offline
 
Join Date: Feb 2014
Posts: 6
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Quote:
Originally Posted by NeutralizeR View Post
It is possible. I guess somebody else can create a vB 4 version of this mod.

I'll do it when I have time, if nobody else is willing to do...
Is there some news about this?
Reply With Quote
Reply


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 03:53 PM.


Powered by vBulletin® Version 3.8.12 by vBS
Copyright ©2000 - 2024, vBulletin Solutions Inc.
X vBulletin 3.8.12 by vBS Debug Information
  • Page Generation 0.05918 seconds
  • Memory Usage 2,369KB
  • Queries Executed 26 (?)
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
  • (5)bbcode_code
  • (3)bbcode_php
  • (6)bbcode_quote
  • (1)footer
  • (1)forumjump
  • (1)forumrules
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (1)modsystem_post
  • (1)navbar
  • (4)navbar_link
  • (120)option
  • (1)pagenav
  • (1)pagenav_curpage
  • (3)pagenav_pagelink
  • (11)post_thanks_box
  • (13)post_thanks_box_bit
  • (11)post_thanks_button
  • (1)post_thanks_javascript
  • (1)post_thanks_navbar_search
  • (2)post_thanks_postbit
  • (11)post_thanks_postbit_info
  • (10)postbit
  • (1)postbit_attachment
  • (11)postbit_onlinestatus
  • (11)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
  • fetch_musername
  • post_thanks_function_fetch_thanks_end
  • post_thanks_function_thanked_already_start
  • post_thanks_function_thanked_already_end
  • post_thanks_function_fetch_thanks_bit_start
  • post_thanks_function_show_thanks_date_start
  • post_thanks_function_show_thanks_date_end
  • post_thanks_function_fetch_thanks_bit_end
  • post_thanks_function_fetch_post_thanks_template_start
  • post_thanks_function_fetch_post_thanks_template_end
  • postbit_imicons
  • bbcode_parse_start
  • bbcode_parse_complete_precache
  • bbcode_parse_complete
  • postbit_attachment
  • postbit_display_complete
  • post_thanks_function_can_thank_this_post_start
  • pagenav_page
  • pagenav_complete
  • tag_fetchbit_complete
  • forumrules
  • navbits
  • navbits_complete
  • showthread_complete