Markup: Mobile Output fails

Creating and modifying plugins.
Post Reply
lfrantzen
Regular
Posts: 55
Joined: Fri May 02, 2008 1:24 pm
Location: Munich, Germany
Contact:

Markup: Mobile Output fails

Post by lfrantzen »

Hi,

I added the Markup: Mobile Output plugin v1.0 via Spartacus, and turned it on with standard settings. When accessing my page with an iPhone I get this error:

Code: Select all

Warning: DOMDocument::loadHTML() [domdocument.loadhtml]:
htmlParseEntityRef: expecting ';' in Entity, line 6 in
/blabla/serendipity/plugins/serendipity_event_mobile_output/mobile.class.php
on line 60
I am running Serendipity 1.5.4 and PHP 5.2.14
You can check this here: http://www.frantzen.info/

I am happy for every hint,
thanks and cheers!
Lars
garvinhicking
Core Developer
Posts: 30022
Joined: Tue Sep 16, 2003 9:45 pm
Location: Cologne, Germany
Contact:

Re: Markup: Mobile Output fails

Post by garvinhicking »

Hi!

I believe the MobileOutput plugin is picky about HTML entites. In HTML you need to mask "&" as "&" always, because "&" itself is an entity and not ellowed in XHTML.

So check your blog articles if you have somethin like "I like ice&cream" because then dom document would expect "&cream;" (which is not an entity).

HTH,
Garvin
# Garvin Hicking (s9y Developer)
# Did I help you? Consider making me happy: http://wishes.garv.in/
# or use my PayPal account "paypal {at} supergarv (dot) de"
# My "other" hobby: http://flickr.garv.in/
lfrantzen
Regular
Posts: 55
Joined: Fri May 02, 2008 1:24 pm
Location: Munich, Germany
Contact:

Re: Markup: Mobile Output fails

Post by lfrantzen »

Hi Garvin,

thanks for the quick reply! Unfortunately still no success. I disabled all blog entries by making them drafts, and ensured that all remaining pages are successfully checked as XHTML 1.1

I first deinstalled the Markup: Mobile plugin. Removing it showed me first this error within the "Configure Plugins" page:

Code: Select all

Warning: Invalid argument supplied for foreach() in /homepages/10/d243342463/htdocs/serendipity/plugins/serendipity_event_entryproperties/serendipity_event_entryproperties.php on line 642
Anyhow, I installed it again. When I now go with an iPhone to my page I get this error:

Code: Select all

Warning: Cannot use a scalar value as an array in
/blabla/serendipity/plugins/serendipity_event_mobile_output/serendipity_event_mobile_output.php
on line 250
:?

You can check this still at http://www.frantzen.info/

Thanks and cheers,
Lars
lfrantzen
Regular
Posts: 55
Joined: Fri May 02, 2008 1:24 pm
Location: Munich, Germany
Contact:

Re: Markup: Mobile Output fails

Post by lfrantzen »

Update:
I am one step further, found the hint in some other postings that Spartacus does not install the necessary templates for the plugin. Downloading the stuff from http://c.mobile-seo.de/ does at least remove the errors I mentioned, and does now show some simplified version of the blog when being accessed via an iPhone.

Though, it does not seem to use the iPhone template. Instead some general (default?) template is used. The HTML code of the blog page says:

Code: Select all

<meta name="generator" content="Serendipity IPhone Output - http://c.seo-mobile.de/"/>
<meta name="viewport" content="width=device-width; initial-scale=1.0; maximum-scale=1.0; user-scalable=0;"/>
<script type="application/x-javascript" src="/templates/iphone.app/iui.js"></script>
<link rel="stylesheet" type="text/css" href="http://www.frantzen.info/serendipity.css.php?switch=iphone.app"/>
So, I am puzzled again :wink:

Any hint is highly appreciated.

Cheers,
Lars
garvinhicking
Core Developer
Posts: 30022
Joined: Tue Sep 16, 2003 9:45 pm
Location: Cologne, Germany
Contact:

Re: Markup: Mobile Output fails

Post by garvinhicking »

Hi!

Hm, since I sadly never used the plugin myself I'm a bit unsure as to how it should look like :(

Do you know if the template comes with some CSS that should be utilized? Calling http://www.frantzen.info/serendipity.cs ... iphone.app seems like the vanilly CSS from serendpity without any specific iphone formatting...

Regards,
Garvin
# Garvin Hicking (s9y Developer)
# Did I help you? Consider making me happy: http://wishes.garv.in/
# or use my PayPal account "paypal {at} supergarv (dot) de"
# My "other" hobby: http://flickr.garv.in/
lfrantzen
Regular
Posts: 55
Joined: Fri May 02, 2008 1:24 pm
Location: Munich, Germany
Contact:

Re: Markup: Mobile Output fails

Post by lfrantzen »

Hi Garvin,

it should look similar to this:
http://www.mobile-seo.de/archiv/35-sere ... lease.html
There are a few comments at that blog post from people which seem to have the same problem. Unfortunately there is no reaction to that comments...

There is a css file coming with the plugin:
templates/iphone.app/style.css
I attached that.

Somehow it does not seem to use that CSS?

Thanks and cheers,
Lars
Attachments
style.css.txt
(8.26 KiB) Downloaded 388 times
garvinhicking
Core Developer
Posts: 30022
Joined: Tue Sep 16, 2003 9:45 pm
Location: Cologne, Germany
Contact:

Re: Markup: Mobile Output fails

Post by garvinhicking »

Hi!

In the configuration of the plugin, is your template set to "iphone.app" or "xhtml_mp"? iphone.app should be the proper one, if you want to have the iphone layout, it seems to me?!

Regards,
Garvin
# Garvin Hicking (s9y Developer)
# Did I help you? Consider making me happy: http://wishes.garv.in/
# or use my PayPal account "paypal {at} supergarv (dot) de"
# My "other" hobby: http://flickr.garv.in/
lfrantzen
Regular
Posts: 55
Joined: Fri May 02, 2008 1:24 pm
Location: Munich, Germany
Contact:

Re: Markup: Mobile Output fails

Post by lfrantzen »

HiHo,

in the config you can set two templates:

Mobile template which is set to xhtml_mp and
iPhone template which is set to iphone.app

Even if I also set the Mobile template to iphone.app it does not change anything.

Cheers,
Lars

P.S. You are probably aware of this, but in any case, there is a Firefox plugin called "User Agent Switcher" which lets you appear as being an iPhone. If someone wants to check the output without the iPhone hassle...
garvinhicking
Core Developer
Posts: 30022
Joined: Tue Sep 16, 2003 9:45 pm
Location: Cologne, Germany
Contact:

Re: Markup: Mobile Output fails

Post by garvinhicking »

Hi!

Are you in for some debugging? :)

First off, which other event plugins are you using? Especially the template switcher and "Extended Options/Templates for Categories" plugin can interfer.

Secondly, please patch your serendipity.css.php. At the end you see this:

Code: Select all

serendipity_plugin_api::hook_event($css_hook, $out);
now add this:

Code: Select all

$out .= 'Stylesheet for ' . $css_file . ' fetched from: ' . serendipity_getTemplateFile($css_file, 'serendipityPath') . ' of template: ' . $serendipity['template'] . '.';
Now when you open the URL for the CSS (serendipity.css.php?Switch=bla) you should see this output at the end, which should actually contain something like "Stylesheet for style.css fetched from: templates/iphone.app/style.css of template iphone.app".

Regards,
Garvin
# Garvin Hicking (s9y Developer)
# Did I help you? Consider making me happy: http://wishes.garv.in/
# or use my PayPal account "paypal {at} supergarv (dot) de"
# My "other" hobby: http://flickr.garv.in/
lfrantzen
Regular
Posts: 55
Joined: Fri May 02, 2008 1:24 pm
Location: Munich, Germany
Contact:

Re: Markup: Mobile Output fails

Post by lfrantzen »

Hi Garvin,

this is crazy, I applied your patch and opened the URL:
http://www.frantzen.info/serendipity.cs ... iphone.app

giving me at the end:

Code: Select all

Stylesheet for style.css fetched from: /kunden/homepages/10/d243342463/htdocs/serendipity/templates/iphone.app/style.css of template: iphone.app.
And then (just for fun) I reloaded again the normal blog page with an iPhone and now the thing works?! I know your patch is a mere debugging output, so there is no real relation here. After undoing the patch the thing still works.

Eh, yes. I am sorry for the hassle, I really have no clue what happened. Also the error which appeared before when I uninstalled the plugin is now gone. I uninstalled, reinstalled, still works.

Ok, remains to say a big thanks for your effort, leaves me with a working system, and a weird feeling that I have no clue why :D

Cheers,
Lars
garvinhicking
Core Developer
Posts: 30022
Joined: Tue Sep 16, 2003 9:45 pm
Location: Cologne, Germany
Contact:

Re: Markup: Mobile Output fails

Post by garvinhicking »

Hi!

Not a problem. I somehow suppose that the CSS got cached in your browser; usually the "switch" part of the url should make sure that this isnt the case. But I believe due to the config changes of the plugin they didn't yet take effect and it got cached in the misconfigured way.

I will try if I can think of a better method to prevent that caching problem somehow.

Best regards,
Garvin
# Garvin Hicking (s9y Developer)
# Did I help you? Consider making me happy: http://wishes.garv.in/
# or use my PayPal account "paypal {at} supergarv (dot) de"
# My "other" hobby: http://flickr.garv.in/
lfrantzen
Regular
Posts: 55
Joined: Fri May 02, 2008 1:24 pm
Location: Munich, Germany
Contact:

Re: Markup: Mobile Output fails

Post by lfrantzen »

Hi Garvin,

yes, looks a bit like a caching problem. Summing up the experience I gained: it's nice to have this plugin, though it seems to be hard to really get it set up in a decent way, especially when having static pages. For instance, when your main page is not the blog page, I have not found a good way yet to forward the user to the blog page (the mobile theme does not contain the menu buttons). In the config of the plugin you can redirect mobile devices to another host, but that does not help here since the redirect holds for all the pages then (so also the blog page itself).

But even when the mobile user accesses the blog, one crucial feature is missing: the option to turn off the mobile theme, which keeps one trapped into the mobile output. This gives no route back to information which might be on static pages, or information hidden away by the mobile theme.

Also, that the developers themselves use WPTouch now for their site does not add confidence that the development of the plugin will continue. If I would understand more (anything) of how this all works, I would try to improve a bit myself, and maybe I will try, but that is nothing to hope for :wink:

Somehow these mobile variants of pages remind a bit of the WAP efforts, which never succeeded. So maybe doing without a mobile version at all is the best choice at the end. At least an option to turn the mobile version off seems to be crucial.

Anyhow, thanks again for your help!
Cheers,
Lars
garvinhicking
Core Developer
Posts: 30022
Joined: Tue Sep 16, 2003 9:45 pm
Location: Cologne, Germany
Contact:

Re: Markup: Mobile Output fails

Post by garvinhicking »

Hi!

Yes, I see what you mean. Personally, I don'T like mobile versions of webapges. I really prefer to only have lightweight CSS for mobile output, not a completely different theme with iOS mockups or whatever.

To bypass the theme, the most easy (and hacky) way would be to install the "Template selector" EVENT(!) plugin. And place it AFTER(!) the mobile output plugin. Once that is done, you can add a link in your blog like "index.php?user_template=default" this should override the mobile output plugin and set the default template to render your content.

This is untested (since I don't have a working temp blog right now) but I believe it should work. Basically, the mobile output plugin could also be patched and react on such a URL variable, and if that is set, set a $_SESSION (or cookie) variable to prevent the changeing of the template in follow-up URL calls.

Regards,
Garvin
# Garvin Hicking (s9y Developer)
# Did I help you? Consider making me happy: http://wishes.garv.in/
# or use my PayPal account "paypal {at} supergarv (dot) de"
# My "other" hobby: http://flickr.garv.in/
lfrantzen
Regular
Posts: 55
Joined: Fri May 02, 2008 1:24 pm
Location: Munich, Germany
Contact:

Re: Markup: Mobile Output fails

Post by lfrantzen »

Hi Garvin,

thanks for the tips, will try that!

Cheers,
Lars
Post Reply