Go to main content

Textpattern CMS support forum

You are not logged in. Register | Login | Help

#49 2016-02-03 15:41:06

RedFox
Member
From: Netherlands
Registered: 2005-03-25
Posts: 805
Website

Re: adi_mobile - Mobile browser detection

<txp:adi_mobile_script /> at the top of the page after jQuery … still no “landscapemedium” … !?

Last edited by RedFox (2016-02-03 16:33:48)

Offline

#50 2016-02-03 20:15:10

gomedia
Plugin Author
Registered: 2008-06-01
Posts: 1,373

Re: adi_mobile - Mobile browser detection

There’re a number of TXP variables set in the background – have a look at the “Testing & Diagnostics” section of the plugin help – display the values to see if you can see what is or what’s not being detected. Hopefully that’ll point us in the right direction.

Offline

#51 2016-02-03 22:02:58

RedFox
Member
From: Netherlands
Registered: 2005-03-25
Posts: 805
Website

Re: adi_mobile - Mobile browser detection

<txp:variable name="adi_mobile_viewport" /> gives: ?,?,?
<txp:variable name="adi_mobile_width" /> gives: ? (narrow)

joopvos.nl/new/20151216

Last edited by RedFox (2016-02-03 22:09:10)

Offline

#52 2016-02-04 07:12:57

gomedia
Plugin Author
Registered: 2008-06-01
Posts: 1,373

Re: adi_mobile - Mobile browser detection

Looks like the script is not running. I can’t see it in the <head>. Is it definitely in the page template?

Offline

#53 2016-02-04 08:27:00

RedFox
Member
From: Netherlands
Registered: 2005-03-25
Posts: 805
Website

Re: adi_mobile - Mobile browser detection

Indeed … there’s nothing going on. But the <txp:adi_mobile_script /> is in the <head> > screenshot … !?

Offline

#54 2016-02-04 20:54:21

gomedia
Plugin Author
Registered: 2008-06-01
Posts: 1,373

Re: adi_mobile - Mobile browser detection

Very curious … there’re should be something – even if it’s a message to say “no script”. I’ll give you a shout off-piste.

Offline

#55 2016-02-04 21:22:47

gomedia
Plugin Author
Registered: 2008-06-01
Posts: 1,373

Re: adi_mobile - Mobile browser detection

Just noticed … you need a <txp:adi_mobile /> tag at the very top of the page, otherwise nothing will work

Offline

#56 2016-02-05 04:34:17

RedFox
Member
From: Netherlands
Registered: 2005-03-25
Posts: 805
Website

Re: adi_mobile - Mobile browser detection

@Adi … It does not matter. Wherever you put the tag; the script won’t be executed … :(

Offline

#57 2016-02-06 06:07:16

RedFox
Member
From: Netherlands
Registered: 2005-03-25
Posts: 805
Website

Re: adi_mobile - Mobile browser detection

It’s all about logic thinking, which I’m not good at … so Adi came up with this:

Page:

<txp:adi_mobile narrow="640" />
<txp:adi_mobile_script />

Article:

<txp:smdadi id="182" type="landscapemedium" />

smd_macros:

<txp:adi_if_mobile>
	<txp:adi_if_mobile width="narrow">
		<txp:smd_thumbnail id="{img_id}" type="small" />
	<txp:else />
		<txp:smd_thumbnail id="{img_id}" type="{style}" />
	</txp:adi_if_mobile>
<txp:else />
	<txp:smd_thumbnail id="{img_id}" type="{style}" />
</txp:adi_if_mobile>

… and it works like a charm … :))

Last edited by RedFox (2016-02-06 06:11:12)

Offline

#58 2016-02-08 08:11:34

RedFox
Member
From: Netherlands
Registered: 2005-03-25
Posts: 805
Website

Re: adi_mobile - Mobile browser detection

And if you want to know all there is … here’s some special tagsoup from Adi:

<txp:adi_if_mobile>
MOBILE,
<txp:else />
<txp:adi_if_mobile type="tablet">
TABLET,
<txp:else />
NOT MOBILE OR TABLET,
</txp:adi_if_mobile>
</txp:adi_if_mobile>
<br>
<txp:adi_if_mobile>
<txp:adi_if_mobile width="narrow">
NARROW
<txp:else />
<txp:adi_if_mobile width="wide">
WIDE
<txp:else />
<txp:adi_if_mobile width="?">
UNKNOWN WIDTH
<txp:else />
MEDIUM
</txp:adi_if_mobile>
</txp:adi_if_mobile>
</txp:adi_if_mobile>
<br/>
adi_mobile_types = <txp:variable name="adi_mobile_types" /><br>
adi_mobile_viewport = <txp:variable name="adi_mobile_viewport" /><br>
<txp:else />
VIEWPORT DETECTION DISABLED<br/>
</txp:adi_if_mobile>
adi_mobile_useragent = <txp:variable name="adi_mobile_useragent" />

… outcome DESKTOP > screenshotMOBILE > screenshot

Last edited by RedFox (2016-02-08 08:11:59)

Offline

#59 2018-06-13 19:20:31

detail
Member
From: geez, I seem to be in NZ
Registered: 2010-07-13
Posts: 176
Website

Re: adi_mobile - Mobile browser detection

Hi Adi

I am updating my website and have a glitch.

I have just updated txp to 4.7 and am getting this note in my diagnostics:

Tag error: <txp:adi_mobile /> ->  Textpattern Notice: adi_mobile tag is not registered while parsing form None on page mobile June 2015
textpattern/lib/txplib_publish.php:562 trigger_error()
textpattern/lib/txplib_publish.php:471 processTags()
textpattern/lib/txplib_misc.php:4431 parse()
textpattern/publish.php:581 parse_page()
index.php:116 textpattern()
Tag error: <txp:adi_if_mobile>

<txp:thumbnail id="1" />

<txp:else />

<txp:image id="1" />
  <header role="banner">
      <h1><txp:site_name /></h1>
      <h3><txp:site_slogan /></h3>
  </header>

</txp:adi_if_mobile> ->  Textpattern Notice: adi_if_mobile tag is not registered while parsing form None on page mobile June 2015
textpattern/lib/txplib_publish.php:562 trigger_error()
textpattern/lib/txplib_publish.php:471 processTags()
textpattern/lib/txplib_misc.php:4431 parse()
textpattern/publish.php:581 parse_page()
index.php:116 textpattern()

The page is coming up okay on my laptop, but it is not switching to the mobile version that throws up the thumbnail and an altered CSS.

Any thoughts on how to resolve this?

Offline

#60 2018-06-13 20:58:37

gomedia
Plugin Author
Registered: 2008-06-01
Posts: 1,373

Re: adi_mobile - Mobile browser detection

Hi Graeme,

I haven’t updated the plugin for the new tag registry. The workaround is to edit it and insert the following at the top somewhere:

if (class_exists('\Textpattern\Tag\Registry')) {
	Txp::get('\Textpattern\Tag\Registry')
		->register('adi_mobile')
		->register('adi_if_mobile')
		->register('adi_if_not_mobile')
	;
}

Offline

Board footer

Powered by FluxBB