Go Back   vb.org Archive > vBulletin Modifications > vBulletin 3.8 Modifications > vBulletin 3.8 Add-ons

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
  #42  
Old 06-26-2017, 04:58 AM
pri.studynama pri.studynama is offline
 
Join Date: Jan 2015
Location: India
Posts: 5
Благодарил(а): 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...
Hi NeutralizeR,

Great mod! I am using VB 4.2.4 and keen to use this on my site. Do you have plans to release this for VB 4.x? Or can you guide me with the process to implement this on my 4.2.4 site.

Cheers,
An avid VB user!
Reply With Quote
  #43  
Old 08-24-2017, 09:44 AM
Akeles Akeles is offline
 
Join Date: May 2010
Location: Egypt
Posts: 12
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

I added it to my forum with some edits
Reply With Quote
  #44  
Old 12-10-2017, 03:02 PM
dany_danay dany_danay is offline
 
Join Date: Jul 2009
Posts: 142
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Someone can edit to 4.2?
Reply With Quote
  #45  
Old 12-10-2017, 04:08 PM
Dave Dave is offline
 
Join Date: May 2010
Posts: 2,583
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Quote:
Originally Posted by dany_danay View Post
Someone can edit to 4.2?
Honestly, I would avoid Google AMP. If you do a bit of researching you'll see that it has more negatives than positives, including decreased ad-revenue. It's all aimed at speed. So unless that's your main goal, don't use it.
Reply With Quote
  #46  
Old 02-14-2018, 09:16 AM
unitedpunjab unitedpunjab is offline
 
Join Date: Feb 2006
Location: Scotland
Posts: 286
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

attachments are not showing on amp pages, any solution ?
Reply With Quote
  #47  
Old 08-17-2018, 01:55 AM
m7sen m7sen is offline
 
Join Date: Mar 2014
Posts: 153
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

hi

thanks for this addon , I did it on 3.8.8
but it doesn't work when I check the console log, it said this

PHP Code:
extensions-impl.js:509 Powered by AMP &#9889; HTML – Version 1534444305877 https://www.xxxxxx.com/vb/amp.php?t=32366#development=1
mozbar.moz.com/bartender/url-metrics:1 Failed to load resourcethe server responded with a status of 403 ()
content_page.js:2561 Bartender API access denied.
SerpResultsMetrics.handleError content_page.js:2561
validator
.js:1001 AMP validation had errors:
amp$validator$Terminal.error validator.js:1001
validator
.js:1001 https://www.xxxxxx.com/vb/amp.php?t=32366:447:5 Custom JavaScript is not allowed. (see https://www.ampproject.org/docs/reference/spec#html-tags)
amp$validator$Terminal.error validator.js:1001
validator
.js:1023 See also https://validator.ampproject.org/#url=https://www.xxxxxx.com/vb/amp.php?t=3D32366
2start:1 Failed to load resourcethe server responded with a status of 400 () 
- I also test it on https://search.google.com/test/amp

it said:
Custom JavaScript is not allowed.
line 446:5
PHP Code:
<script type="text/javascript"
I tried to remove Google Analytics but it doesn't work!

Update ***************

I fix it.
open ampthread template.

search on:
PHP Code:
<script async src="https://cdn.ampproject.org/v0.js"></script>
<
script async custom-element="amp-ad" src="https://cdn.ampproject.org/v0/amp-ad-0.1.js"></script>
<
script async custom-element="amp-analytics" src="https://cdn.ampproject.org/v0/amp-analytics-0.1.js"></script
move it to be above
PHP Code:
<style amp-custom>
body 
search on
PHP Code:
<meta name="viewport" content="width=device-width,minimum-scale=1,initial-scale=1"
add this under it
PHP Code:
<script async custom-element="amp-carousel" src="https://cdn.ampproject.org/v0/amp-carousel-0.1.js"></script
--------------------

Another issue comes on theads pages
https://www.xxxxxx.com/vb/amp.php?t=127909&page=140

is will give you this error on amp google test
PHP Code:
Forbidden or incorrect use of the HTML tag
The 
'nowrap' attribute can not appear in the 'td' tag.

    <
td class="alt1" nowrap="nowrap"><class="smallfont" href="amp.php?t=127909&amp;page=216" title="last page - Results 1,076 to 1,077 from 1,077"><strong>?</strong></a></td
i tried to fix it, and it's work with me but I don't know if it currect
go to pagenav tamplete
search on:
PHP Code:
nowrap="nowrap" 
change it to:
PHP Code:
style="white-space:nowrap" 
End ***************

* There are general issue
very important! must add schema.org data
PHP Code:
    <script type="application/ld+json">
    {
      
"@context""http://schema.org",
      
"@type""NewsArticle",
      
"headline""Article headline",
      
"image": [
        
"thumbnail1.jpg"
      
],
      
"datePublished""2015-02-05T08:00:00+08:00"
    
}
    </
script
but the problem is I don't know how to edit the information like:
PHP Code:
"@context""http://schema.org",
"@type""NewsArticle",
"headline""Article headline"
so I tried to make it by using
https://www.google.com/webmasters/markup-helper/

search on
PHP Code:
<meta name="viewport" content="width=device-width,minimum-scale=1,initial-scale=1"
add this under it
PHP Code:
<script type="application/ld+json">
{
  
"@context" "http://schema.org",
  
"@type" "Article",
  
"name" "$threadinfo[title]",
  
"author" : {
    
"@type" "Person",
    
"name" "$post[username]"
  
},
  
"datePublished" "$post[postdate] - $post[posttime]",
  
"image" "$post[avatarurl]",
  
"articleSection" "$vboptions[bburl]/Channel$foruminfo[forumid]",
  
"articleBody" "$post[message]",
  
"url" "$vboptions[bburl]/blackberry$threadid.html",
  
"publisher" : {
    
"@type" "Organization",
    
"name" "$vboptions[bbtitle]"
    "url" 
"$vboptions[bburl]",
  }
}
</
script
now the problem in those
PHP Code:
  "name" "$post[username]"
  "datePublished" 
"$post[postdate] - $post[posttime]",
  
"articleBody" "$post[message]"
I tried to fix it but it doesn't show on "View page source"

another issue, there is no choose to turn amp off or run it again.

* My issue
- I have an issue using DBSEO, need to change the link to be
PHP Code:
amp.php?t=32366 => amp-t32366.html 
i tried any&every thing
PHP Code:
'amp.php?t(.+)' => 'amp-t$1'
'amp.php?t=(.*)' 
=> 'amp-t(.*).html'
'amp.php?t=(.*)' 
=> 'amp-t$1.html'
'^amp\.php\?t=(\d+)' 
=> '/amp/$1'
'^amp\.php\?t=(\d+)' 
=> 'amp/$1.html'
'^amp\.php\?t=(\d+)' 
=> 'amp-t$1.html'
'^amp\.php\?t=(\d+)&page=(\d+)$' 
=> 'amp-t$1-$2.html' 
but nothings work!

I also need to make the template RTL.

some Idea !

- I wonder if It possible to make all style as amp ? such forums and user profile ?

- Is it possible to make copy from the archive folder and rename it to amp and make the editing to be amp ? and add script or meta name to head-include template !

any help ?
Reply With Quote
  #48  
Old 08-18-2018, 10:50 PM
m7sen m7sen is offline
 
Join Date: Mar 2014
Posts: 153
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Bugs!


I got new issue from theards in the posts
PHP Code:
An HTML tag is blocked on an equivalent speed mobile page.
The tag 'img' may only appear as a descendant of tag 'noscript'Did you mean 'amp-img'

PHP Code:
<img style="filter:fliph" border="0" src="xxxx" border="0" /><br /> 
I'm trying to fix it.

I i tried to fix this line in class_bbcode.php file
PHP Code:
return "<img src=\"$sigpic_url\" alt=\"$description\" border=\"0\" />"
to be
PHP Code:
        if (THIS_SCRIPT == 'amp')
        {
            return 
"<img-amp src=\"$sigpic_url\" alt=\"$description\" border=\"0\" ></amp-img>";
        } 
//amp hack
        
else if ($this->registry->userinfo['userid'] == OR $this->registry->userinfo['showimages'])
        {
            return 
"<img src=\"$sigpic_url\" alt=\"$description\" border=\"0\" />";
        } 
but nothing happend!

the problem is this line
PHP 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 
in class_bbcode.php file doesn't affect the posts!
Its just affect the first post only!

---------------

css 'tg' & 'table' issue
PHP Code:
CSS syntax error in tag 'td' invalid declaration.
CSS syntax error in tag 'table' invalid declaration
I think the problem from bbcode_quote tamplete
PHP Code:
<if condition="THIS_SCRIPT == 'amp'">
<
div class="bbcode-quote">
<
div class="bbcode-quote-text">
    <
div class="smallfont time">$vbphrase[quote]</div>
            <if 
condition="$show['username']">
                <
span class="smallfont">
                <
phrase 1="$username">$vbphrase[originally_posted_by_x]</phrase>
                <if 
condition="$postid"><class="font15" href="showthread.php?$session[sessionurl]p=$postid#post$postidtitle="$vbphrase[view_post]rel="nofollow"><b>&raquo;</b></a></if>
                </
span>
                <
div class="msx-quote"><p>$message</p></div>
            <else />
                <
div class="msx-quote"><p>$message</p></div>
            </if>
</
div>
</
div>

<else />

<
div style="margin:20px; margin-top:5px; <if condition="$show['iewidthfix']">width: 100%;</if>">
    <
div class="smallfont" style="margin-bottom:2px">$vbphrase[quote]:</div>
    <
table cellpadding="$stylevar[cellpadding]cellspacing="0" border="0" width="100%">
    <
tr>
        <
td class="alt2" style="border:1px inset">
            <if 
condition="$show['username']">
                <
div>
                    <
phrase 1="$username">$vbphrase[originally_posted_by_x]</phrase>
                    <if 
condition="$postid"><a href="showthread.php?$session[sessionurl]p=$postid#post$postidrel="nofollow"><img class="inlineimg" src="$stylevar[imgdir_button]/viewpost.gif" border="0" alt="$vbphrase[view_post]/></a></if>
                </
div>
                <
div style="font-style:italic">$message</div>
            <else />
                
$message
            
</if>
        </
td>
    </
tr>
    </
table>
</
div>
</if> 
I couldn't fix it

I'm afraid I must to remove every things! because those issues make the site die.
Reply With Quote
  #49  
Old 08-07-2020, 08:12 AM
esskmk esskmk is offline
 
Join Date: May 2014
Posts: 9
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

It does not work.
Reply With Quote
Reply

Thread Tools

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 02:58 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.07360 seconds
  • Memory Usage 2,435KB
  • 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
  • (3)bbcode_code
  • (26)bbcode_php
  • (2)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
  • (2)pagenav_pagelink
  • (9)post_thanks_box
  • (12)post_thanks_box_bit
  • (9)post_thanks_button
  • (1)post_thanks_javascript
  • (1)post_thanks_navbar_search
  • (1)post_thanks_postbit
  • (9)post_thanks_postbit_info
  • (8)postbit
  • (1)postbit_attachment
  • (9)postbit_onlinestatus
  • (9)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_postinfo_query
  • fetch_postinfo
  • 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