AMPXF - AMP for Xenforo 2

AMPXF - AMP for Xenforo 2 [Paid] 1.4.7 Patch Level 9

No permission to buy (€50.00)

mazzly

Well-known member
Well I guess I need to clarify it once more here:
  • The AMPBot doesn't execute JavaScript, so Google Analytics will be unaffected by it crawling & validating
  • The AMPBot doesn't "come in via a search engine" so e.g. Google Search Console stats is also unaffected by it..
So as long as you use analytics tools that "checks this is an actual user", the AMPBot won't affect it.

If you look at server logs, of course you will the see the AMPBot there visiting, just like you will see googlebot. bingbot, duckduckbot, baiduspider, etc etc etc :)

Hope that clears it up, if anyone wonders about this :)
 

mazzly

Well-known member
Does fixed this issue?
Can you please open a support ticket about this? :) Things you post in this thread will "drown away" between all the other posts :D

Also why AMPXFBot Viewing unknown page?

ScreenShot00173.png
It is from the bot visiting it's own endpoint to check version etc :)
 

Southfork1

Active member
Seams to be working now however it looks like I have additonal things on my end to fix. One of which is on CloudFlare trying to turn on Amp Real URL which results in the following ...

What am I missing?

1612907673406.png
 

lantek

Active member
Has anyone had a problem with adsense ad units causing horizontal scroll bars? I'm getting the same results with responsive adsense or fixed size.
 

mazzly

Well-known member
Has anyone had a problem with adsense ad units causing horizontal scroll bars? I'm getting the same results with responsive adsense or fixed size.
In early beta testing we had some cases for this, which was the addon's fault because it was missing some negative margin styles, but that was solved already back in november/december.

Could you open a support ticket on ampxf.com for this and I can have a peek at what might be causing this :)
 

Abu Ghaith

Well-known member
I have This error

Server error log
PHP:
ErrorException: Template error: [E_USER_WARNING] Cannot call method canViewAttachments on a non-object (NULL) src/XF/Template/Templater.php:1151

Stack trace

PHP:
#0 [internal function]: XF\Template\Templater->handleTemplateError(512, '[E_USER_WARNING...', '/home/xenarabia...', 1151, Array)
#1 src/XF/Template/Templater.php(1151): trigger_error('Cannot call met...', 512)
#2 internal_data/code_cache/templates/l2/s7/public/post_macros.php(488): XF\Template\Templater->method(NULL, 'canViewAttachme...', Array)
#3 src/XF/Template/Templater.php(799): XF\Template\Templater->{closure}(Object(MaZ\AMP\XF\Template\Templater22), Array, NULL)
#4 src/addons/MaZ/AMP/XF/Template/Templater.php(94): XF\Template\Templater->callMacro('post_macros', 'post_user_conte...', Array, Array, Object(XF\Template\MacroState))
#5 internal_data/code_cache/templates/l2/s7/public/post_macros.php(60): MaZ\AMP\XF\Template\Templater->callMacro(NULL, 'post_user_conte...', Array, Array)
#6 src/XF/Template/Templater.php(962): XF\Template\Templater->{closure}(Object(MaZ\AMP\XF\Template\Templater22), Array, Object(XF\Template\ExtensionSet))
#7 src/XF/Template/Templater.php(898): XF\Template\Templater->renderExtensionInternal('user_content', Array, Array, Object(XF\Template\ExtensionSet))
#8 internal_data/code_cache/templates/l2/s7/public/post_macros.php(100): XF\Template\Templater->renderExtension('user_content', Array, Object(XF\Template\ExtensionSet))
#9 src/XF/Template/Templater.php(962): XF\Template\Templater->{closure}(Object(MaZ\AMP\XF\Template\Templater22), Array, Object(XF\Template\ExtensionSet))
#10 src/XF/Template/Templater.php(898): XF\Template\Templater->renderExtensionInternal('content', Array, Array, Object(XF\Template\ExtensionSet))
#11 internal_data/code_cache/templates/l2/s7/public/post_macros.php(129): XF\Template\Templater->renderExtension('content', Array, Object(XF\Template\ExtensionSet))
#12 src/XF/Template/Templater.php(962): XF\Template\Templater->{closure}(Object(MaZ\AMP\XF\Template\Templater22), Array, Object(XF\Template\ExtensionSet))
#13 src/XF/Template/Templater.php(898): XF\Template\Templater->renderExtensionInternal('main_cell_inner', Array, Array, Object(XF\Template\ExtensionSet))
#14 internal_data/code_cache/templates/l2/s7/public/post_macros.php(143): XF\Template\Templater->renderExtension('main_cell_inner', Array, Object(XF\Template\ExtensionSet))
#15 src/XF/Template/Templater.php(962): XF\Template\Templater->{closure}(Object(MaZ\AMP\XF\Template\Templater22), Array, Object(XF\Template\ExtensionSet))
#16 src/XF/Template/Templater.php(898): XF\Template\Templater->renderExtensionInternal('main_cell', Array, Array, Object(XF\Template\ExtensionSet))
#17 internal_data/code_cache/templates/l2/s7/public/post_macros.php(155): XF\Template\Templater->renderExtension('main_cell', Array, Object(XF\Template\ExtensionSet))
#18 src/XF/Template/Templater.php(962): XF\Template\Templater->{closure}(Object(MaZ\AMP\XF\Template\Templater22), Array, Object(XF\Template\ExtensionSet))
#19 src/XF/Template/Templater.php(898): XF\Template\Templater->renderExtensionInternal('full_body', Array, Array, Object(XF\Template\ExtensionSet))
#20 internal_data/code_cache/templates/l2/s7/public/post_macros.php(185): XF\Template\Templater->renderExtension('full_body', Array, Object(XF\Template\ExtensionSet))
#21 src/XF/Template/Templater.php(799): XF\Template\Templater->{closure}(Object(MaZ\AMP\XF\Template\Templater22), Array, Object(XF\Template\ExtensionSet))
#22 src/addons/MaZ/AMP/XF/Template/Templater.php(94): XF\Template\Templater->callMacro('post_macros', 'post', Array, Array, Object(XF\Template\MacroState))
#23 internal_data/code_cache/templates/l2/s7/public/thread_view.php(834): MaZ\AMP\XF\Template\Templater->callMacro(NULL, 'post_macros::po...', Array, Array)
#24 src/XF/Template/Templater.php(1626): XF\Template\Templater->{closure}(Object(MaZ\AMP\XF\Template\Templater22), Array, Object(XF\Template\ExtensionSet))
#25 src/addons/MaZ/AMP/XF/Template/Templater22.php(49): XF\Template\Templater->renderTemplate('thread_view', Array, true, NULL)
#26 src/XF/Template/Template.php(24): MaZ\AMP\XF\Template\Templater22->renderTemplate('public:thread_v...', Array)
#27 src/XF/Mvc/Renderer/Html.php(48): XF\Template\Template->render()
#28 src/XF/Mvc/Dispatcher.php(458): XF\Mvc\Renderer\Html->renderView('XF:Thread\\View', 'public:amp_thre...', Array)
#29 src/XF/Mvc/Dispatcher.php(440): XF\Mvc\Dispatcher->renderView(Object(XF\Mvc\Renderer\Html), Object(XF\Mvc\Reply\View))
#30 src/XF/Mvc/Dispatcher.php(400): XF\Mvc\Dispatcher->renderReply(Object(XF\Mvc\Renderer\Html), Object(XF\Mvc\Reply\View))
#31 src/XF/Mvc/Dispatcher.php(58): XF\Mvc\Dispatcher->render(Object(XF\Mvc\Reply\View), 'html')
#32 src/XF/App.php(2326): XF\Mvc\Dispatcher->run()
#33 src/XF.php(488): XF\App->run()
#34 index.php(20): XF::runApp('XF\\Pub\\App')
#35 {main}

Request state


PHP:
array(4) {
  ["url"] => string(19) "/threads/591/?amp=1"
  ["referrer"] => bool(false)
  ["_GET"] => array(1) {
    ["amp"] => string(1) "1"
  }
  ["_POST"] => array(0) {
  }
}
 

mazzly

Well-known member
I have This error

Server error log
PHP:
ErrorException: Template error: [E_USER_WARNING] Cannot call method canViewAttachments on a non-object (NULL) src/XF/Template/Templater.php:1151

Stack trace

PHP:
#0 [internal function]: XF\Template\Templater->handleTemplateError(512, '[E_USER_WARNING...', '/home/xenarabia...', 1151, Array)
#1 src/XF/Template/Templater.php(1151): trigger_error('Cannot call met...', 512)
#2 internal_data/code_cache/templates/l2/s7/public/post_macros.php(488): XF\Template\Templater->method(NULL, 'canViewAttachme...', Array)
#3 src/XF/Template/Templater.php(799): XF\Template\Templater->{closure}(Object(MaZ\AMP\XF\Template\Templater22), Array, NULL)
#4 src/addons/MaZ/AMP/XF/Template/Templater.php(94): XF\Template\Templater->callMacro('post_macros', 'post_user_conte...', Array, Array, Object(XF\Template\MacroState))
#5 internal_data/code_cache/templates/l2/s7/public/post_macros.php(60): MaZ\AMP\XF\Template\Templater->callMacro(NULL, 'post_user_conte...', Array, Array)
#6 src/XF/Template/Templater.php(962): XF\Template\Templater->{closure}(Object(MaZ\AMP\XF\Template\Templater22), Array, Object(XF\Template\ExtensionSet))
#7 src/XF/Template/Templater.php(898): XF\Template\Templater->renderExtensionInternal('user_content', Array, Array, Object(XF\Template\ExtensionSet))
#8 internal_data/code_cache/templates/l2/s7/public/post_macros.php(100): XF\Template\Templater->renderExtension('user_content', Array, Object(XF\Template\ExtensionSet))
#9 src/XF/Template/Templater.php(962): XF\Template\Templater->{closure}(Object(MaZ\AMP\XF\Template\Templater22), Array, Object(XF\Template\ExtensionSet))
#10 src/XF/Template/Templater.php(898): XF\Template\Templater->renderExtensionInternal('content', Array, Array, Object(XF\Template\ExtensionSet))
#11 internal_data/code_cache/templates/l2/s7/public/post_macros.php(129): XF\Template\Templater->renderExtension('content', Array, Object(XF\Template\ExtensionSet))
#12 src/XF/Template/Templater.php(962): XF\Template\Templater->{closure}(Object(MaZ\AMP\XF\Template\Templater22), Array, Object(XF\Template\ExtensionSet))
#13 src/XF/Template/Templater.php(898): XF\Template\Templater->renderExtensionInternal('main_cell_inner', Array, Array, Object(XF\Template\ExtensionSet))
#14 internal_data/code_cache/templates/l2/s7/public/post_macros.php(143): XF\Template\Templater->renderExtension('main_cell_inner', Array, Object(XF\Template\ExtensionSet))
#15 src/XF/Template/Templater.php(962): XF\Template\Templater->{closure}(Object(MaZ\AMP\XF\Template\Templater22), Array, Object(XF\Template\ExtensionSet))
#16 src/XF/Template/Templater.php(898): XF\Template\Templater->renderExtensionInternal('main_cell', Array, Array, Object(XF\Template\ExtensionSet))
#17 internal_data/code_cache/templates/l2/s7/public/post_macros.php(155): XF\Template\Templater->renderExtension('main_cell', Array, Object(XF\Template\ExtensionSet))
#18 src/XF/Template/Templater.php(962): XF\Template\Templater->{closure}(Object(MaZ\AMP\XF\Template\Templater22), Array, Object(XF\Template\ExtensionSet))
#19 src/XF/Template/Templater.php(898): XF\Template\Templater->renderExtensionInternal('full_body', Array, Array, Object(XF\Template\ExtensionSet))
#20 internal_data/code_cache/templates/l2/s7/public/post_macros.php(185): XF\Template\Templater->renderExtension('full_body', Array, Object(XF\Template\ExtensionSet))
#21 src/XF/Template/Templater.php(799): XF\Template\Templater->{closure}(Object(MaZ\AMP\XF\Template\Templater22), Array, Object(XF\Template\ExtensionSet))
#22 src/addons/MaZ/AMP/XF/Template/Templater.php(94): XF\Template\Templater->callMacro('post_macros', 'post', Array, Array, Object(XF\Template\MacroState))
#23 internal_data/code_cache/templates/l2/s7/public/thread_view.php(834): MaZ\AMP\XF\Template\Templater->callMacro(NULL, 'post_macros::po...', Array, Array)
#24 src/XF/Template/Templater.php(1626): XF\Template\Templater->{closure}(Object(MaZ\AMP\XF\Template\Templater22), Array, Object(XF\Template\ExtensionSet))
#25 src/addons/MaZ/AMP/XF/Template/Templater22.php(49): XF\Template\Templater->renderTemplate('thread_view', Array, true, NULL)
#26 src/XF/Template/Template.php(24): MaZ\AMP\XF\Template\Templater22->renderTemplate('public:thread_v...', Array)
#27 src/XF/Mvc/Renderer/Html.php(48): XF\Template\Template->render()
#28 src/XF/Mvc/Dispatcher.php(458): XF\Mvc\Renderer\Html->renderView('XF:Thread\\View', 'public:amp_thre...', Array)
#29 src/XF/Mvc/Dispatcher.php(440): XF\Mvc\Dispatcher->renderView(Object(XF\Mvc\Renderer\Html), Object(XF\Mvc\Reply\View))
#30 src/XF/Mvc/Dispatcher.php(400): XF\Mvc\Dispatcher->renderReply(Object(XF\Mvc\Renderer\Html), Object(XF\Mvc\Reply\View))
#31 src/XF/Mvc/Dispatcher.php(58): XF\Mvc\Dispatcher->render(Object(XF\Mvc\Reply\View), 'html')
#32 src/XF/App.php(2326): XF\Mvc\Dispatcher->run()
#33 src/XF.php(488): XF\App->run()
#34 index.php(20): XF::runApp('XF\\Pub\\App')
#35 {main}

Request state


PHP:
array(4) {
  ["url"] => string(19) "/threads/591/?amp=1"
  ["referrer"] => bool(false)
  ["_GET"] => array(1) {
    ["amp"] => string(1) "1"
  }
  ["_POST"] => array(0) {
  }
}
Can you open a support ticket on ampxf.com? :)
 

HJW

Active member
Great that this is working for 2.1!

How can I adjust my if statements in post_macros so that it isn't fired when viewing the amp page?

<xf:if is="($post.position % $xf.options.messagesPerPage) == 13 && $showExtras">

My analytics tag is picking up the main one from SEO settings rather than the one specified in the AMP settings. Is there something else I should change?

Thanks

FYI for anyone trying to enable the cloudflare real URL they have had issues for the last week to fix it - https://community.cloudflare.com/t/amp-error-while-trying-to-enable-it/242627 But it seems that only affects the bounce rate so not too important.
 

mazzly

Well-known member
How can I adjust my if statements in post_macros so that it isn't fired when viewing the amp page?

<xf:if is="($post.position % $xf.options.messagesPerPage) == 13 && $showExtras">
Try if the $isAMP works, I think it should be available there.

My analytics tag is picking up the main one from SEO settings rather than the one specified in the AMP settings. Is there something else I should change?
Oh shoot, didn't think of that scenario, will release a PL1 version where it always overrides with the value set in AMP settings if both are set :)
 

drastic

Well-known member
Hey @mazzly - does this work with the AMS addon, and the advertising addon by @Siropu ?

I want to make sure all my advertisements display within the AMP templates.

Thanks!
 

HJW

Active member
Try if the $isAMP works, I think it should be available there.
Unfortunately that isn't working, always comes back as empty.

Is there anyway to parse an argument in to the post_macros? This is how I call it on thread_view:


Code:
 <xf:macro template="post_macros" name="post"
                        arg-post="{$post}"
                        arg-thread="{$thread}"
                        arg-showExtra="{$showExtra}" />
 

mazzly

Well-known member
Unfortunately that isn't working, always comes back as empty.

Is there anyway to parse an argument in to the post_macros? This is how I call it on thread_view:


Code:
 <xf:macro template="post_macros" name="post"
                        arg-post="{$post}"
                        arg-thread="{$thread}"
                        arg-showExtra="{$showExtra}" />
Actually, it might be missing a thing that would allow the $isAMP to be used in macros.. I will look into it and release a fixed version if so :)
 
  • Like
Reactions: HJW
Top