Problems with mobile output plugin

Creating and modifying plugins.
Post Reply
h999
Regular
Posts: 10
Joined: Fri Feb 17, 2012 6:43 pm

Problems with mobile output plugin

Post by h999 »

Hi everyone,

I am currently testing s9y as a local installation. I am trying to get the mobile output plugin to work, but when I access the site via ms iPhone all I get is a page full of php errors.

Anyone using this plugin successfully?

Thanks

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

Re: Problems with mobile output plugin

Post by garvinhicking »

Hi!

Think about if you were somebody who wants to help you. What question would you ask yourself? :-)

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/
h999
Regular
Posts: 10
Joined: Fri Feb 17, 2012 6:43 pm

Re: Problems with mobile output plugin

Post by h999 »

Hi Garvin,

thanks for your answer. I understand that my post does not contain a whole lot of details.

But at the moment I would really just like to know if the plugin is being successfully used in the community :D

I am just a little confused since the website for the plugin (http://c.mobile-seo.de) is no longer available and I am wondering, if this plugin is no longer being maintained.

I noticed that the new 2k11 template supports mobile devices quite well, but since there is no ETA (that I know of) for the 2k11 template, I am going with the bulletproof template at the moment which does not support mobile output.

Thanks
Luke
Don Chambers
Regular
Posts: 3652
Joined: Mon Feb 13, 2006 2:40 am
Location: Chicago, IL, USA
Contact:

Re: Problems with mobile output plugin

Post by Don Chambers »

You said you are using it on a "local installation" but that you are also hitting the site with your iPhone... can you share the URL so that others with iPhones can see the errors for themselves? If not, can you post the actual errors here?
=Don=
h999
Regular
Posts: 10
Joined: Fri Feb 17, 2012 6:43 pm

Re: Problems with mobile output plugin

Post by h999 »

Hi DonChambers,

it's a localhost url that I cannot share unfortunately.

I installed the plugin using all the default settings. First thing I noticed are the following three lines at the bottom of the settings page for the plugin:
Template iphone.app not installed. You will find one for each type in the plugin directory.
Template android.app not installed. You will find one for each type in the plugin directory.
Template xhtml_mp not installed. You will find one for each type in the plugin directory.
However, all three files are available in the template folder within the plugin folder.

I then access the site via my iPhone and also using an iPhone user agent for Safari/Mac which gives me the following error (repeated 14 times):
Warning: DOMDocument::loadHTML() [domdocument.loadhtml]: htmlParseEntityRef: expecting ';' in Entity, line: 3 in /Users/luke/Sites/serendipity2/plugins/serendipity_event_mobile_output/mobile.class.php on line 65
These are lines 64 thru 68 of mobile.class.php:

Code: Select all

  	// load HTML into DOM a object 
  	if($dom->loadHTML($html))
  		$debug[] = 'DOM successfully parsed';
  	else
  		$debug[] = 'Couldn\'t parse DOM';
I am really no php guru so I can't see anything wrong here. My first thought were missing curly brackets, so I added them without any success.

Maybe I just misconfigured something. I have no idea where to look first :oops:

Thanks for your time.

Luke
h999
Regular
Posts: 10
Joined: Fri Feb 17, 2012 6:43 pm

Re: Problems with mobile output plugin

Post by h999 »

Okay, okay, that's what it was....

I did not know that I would have to move the templates manually to the ./templates folder (d'oh).

I found a hint at Grischa's blog (http://goo.gl/p3kAz) where it said, that the templates would be automatically copied to the templates directory which did not happen for my installation. After copying them manually, everything is working just fine :)

One more thing...
The documentation link in the settings page of the plugin is still pointing to http://c.mobile-seo.de/ which no longer contains any documentation about the plugin. It might have given me the solution in the first place. Is there still a backup of the documentation somewhere?

Thanks and sorry for the confusion
Luke
garvinhicking
Core Developer
Posts: 30022
Joined: Tue Sep 16, 2003 9:45 pm
Location: Cologne, Germany
Contact:

Re: Problems with mobile output plugin

Post by garvinhicking »

Hi!

:) Good you solved that issue.

I believe the old site was not really containing that much documentation, sadly I also don't have it mirrored locally...

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/
h999
Regular
Posts: 10
Joined: Fri Feb 17, 2012 6:43 pm

Re: Problems with mobile output plugin

Post by h999 »

Never mind...

During the last days I took a closer look at the new 2k11 template and the longer I play around with it, the more I like it :D

I especially like how it adapts the layout to every possible screen size. With this template, it really isn't necessary to use the mobile output plugin. It just looks great...


One more off-topic question:

What's the process for updating plugins? Just provide a zipped version to Garvin?

I noticed that the Markdown Event Plugin still ships with Php-Markdown version 1.0.1 and Php-Markdown-Extra version 1.0.1.

The most recent versions are php-Markdown version 1.0.1o and php-Markdown-Extra version 1.2.5 (http://goo.gl/5wLVx). Especially the Extra version contains some very useful new features (e.g. footnotes).

All there is to do is exchange the two php-files in the plugin. I tested it on my local installation and everything is working well.

Now I would like to update the plugin but I have never actively worked with git.
garvinhicking
Core Developer
Posts: 30022
Joined: Tue Sep 16, 2003 9:45 pm
Location: Cologne, Germany
Contact:

Re: Problems with mobile output plugin

Post by garvinhicking »

Hi!

Definitely! A fluid template is IMHO much more convenient, also because it doesn't restrict functionality like reduced themes. Also, it's much more maintainable.
What's the process for updating plugins? Just provide a zipped version to Garvin?
Either that, or if you're working with github, you can issue pull requests for plugins.

About markdown, I believe the problem was that we needed to modify their library to be able to work inside s9y (some global variables and such were replaced, I think). So when upgrading that version, you might first want to compare the original 1.0.1 with the version bundeled in the s9y plugin and see if we were having a vanilla install, or if we modified anything inside there...

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/
h999
Regular
Posts: 10
Joined: Fri Feb 17, 2012 6:43 pm

Re: Problems with mobile output plugin

Post by h999 »

Hi Garvin,

you seem to have a pretty good memory :)

There are indeed some differences (six, to be exact) in the Markdown Extra version 1.0.1 bundled in the plugin and the original version from Michel Fortin (http://michelf.com/docs/projets/php-mar ... -1.0.1.zip).

There are a couple of occurrences of curly brackets to access array members (e.g. line 458):

Code: Select all

$tag{0}
that were changed to square brackets:

Code: Select all

$tag[0]
Everything else is identical. The normal Markdown files (verions 1.0.1c) are identical as well.

From what I understand from the PHP manual (http://php.net/manual/de/language.types.array.php#99015) there is no difference in using curly brackets instead of square brackets to access array members, right?

So if I just replace all the occurences (which are still the same in 1.2.5) with square brackets, everything should be fine, shouldn't it?

I'll be happy to apply these changes and provide a zip-file to you. I have never actively worked with git, so providing a zip file would be easier for me.

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

Re: Problems with mobile output plugin

Post by garvinhicking »

Hi!

Ah, some things come back to my mind. {0} for array access in PHP is in fact deprecated and throws warnings/notices depending on the PHP configuration, so ideally it should stay at [0].

If you can provide a patched update, that would be awesome. Please put up a public URL so that I can easily fetch the ZIP and will upload it to git. MAny thanks! :)

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/
h999
Regular
Posts: 10
Joined: Fri Feb 17, 2012 6:43 pm

Patching PHP Markdown 1.0.1o

Post by h999 »

Alright, I dove right into it and started looking at PHP Markdown 1.0.1o (http://michelf.com/docs/projets/php-markdown-1.0.1o.zip).

In the current version of the plugin, the standard markdown file is unpatched. In the above mentioned version, there seems to be one occurrence that needs to be adjusted.

As said before, I am not a PHP-expert so of course I ran right into a first question.

In PHP Markdown I only found one occurrence of a curly bracket being used to access an array member. Starting in line 905:

Code: Select all

	function _doHeaders_callback_setext($matches) {
		# Terrible hack to check we haven't found an empty list item.
		if ($matches[2] == '-' && preg_match('{^-(?: |$)}', $matches[1]))
			return $matches[0];
		
		$level = $matches[2]{0} == '=' ? 1 : 2;
		$block = "<h$level>".$this->runSpanGamut($matches[1])."</h$level>";
		return "\n" . $this->hashBlock($block) . "\n\n";
	}
From what I understand, in line 6 of the above code, the first character {0} of array member number 3 is accessed. (I have no idea what he is doing with the "? 1 : 2;")

From my research it should be perfectly fine to replace this instance of curly brackets with square brackets since both can be used to access single characters in a string, right?

I hope it is okay if I ask some (stupid) questions.

I really think it's worth updating the markdown plugin since there are some very useful new features.
I am absolutely willing to do it. On the other hand, I don't want to mess it up so I prefer asking.
garvinhicking
Core Developer
Posts: 30022
Joined: Tue Sep 16, 2003 9:45 pm
Location: Cologne, Germany
Contact:

Re: Patching PHP Markdown 1.0.1o

Post by garvinhicking »

Hi!

The "? : " stuff is called ternary syntax, it's the same as if you wrote:
$level = $matches[2]{0} == '=' ? 1 : 2;

if ($matches[2][0] == '=') {
$level = 1;
} else {
$level = 2;
}
And yes, you can simply use [] in AFAIK all places where {number} is currently used.

Thanks for your work!

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/
h999
Regular
Posts: 10
Joined: Fri Feb 17, 2012 6:43 pm

Re: Problems with mobile output plugin

Post by h999 »

The "? : " stuff is called ternary syntax
Thanks a lot! Great to know. This stuff is really hard to google for if you have no clue what it's called...

I am done with the patching. Everything seems to work well.

I am about to send you a PM with the download link.

Regards
Post Reply