Page 1 of 1

130 - Create a Joomla! v 1.5 Plugin to implement A List Apart's Automatic Magazi

Posted: Tue Dec 18, 2007 4:04 pm
by SanderKromwijk
Hi,

I'm the one who did task number 127

Sander Kromwijk

Re: 130 - Create a Joomla! v 1.5 Plugin to implement A List Apart's Automatic Ma

Posted: Tue Dec 18, 2007 5:54 pm
by jlleblanc
Excellent! Looking forward to more of your code  ;D

Re: 130 - Create a Joomla! v 1.5 Plugin to implement A List Apart's Automatic Ma

Posted: Thu Dec 20, 2007 7:25 pm
by SanderKromwijk
Hi,

Here is my first version.

To use it, you have to put {images} at the beginning. Then put an image on each line (with the image button). At the end, put a {/images}

Sander Kromwijk

Re: 130 - Create a Joomla! v 1.5 Plugin to implement A List Apart's Automatic Ma

Posted: Sat Dec 22, 2007 8:57 pm
by SanderKromwijk
Hi,

Here is my final version (unless there are big problems)

Sander Kromwijk

Re: 130 - Create a Joomla! v 1.5 Plugin to implement A List Apart's Automatic Ma

Posted: Sun Dec 23, 2007 2:43 am
by mcsmom
Sander,

Could you put the instructions for use of the plugin into the description? I love the detailed instructions, maybe there is a way to install that on the site somehow?

When I first used the plugin I got some warning messages. However, I figured out what the problem was.

Th plugin was expecting the images to be includes n   ... once i did that it worked. However this wasn't clear from the documentation. I think you should try to modify the program to allow for additonal delimiters, specifically and since both are commonly inserted by wysiwyg editors.

Install and uninstall went great, and the reults are great to look at.  :)

Re: 130 - Create a Joomla! v 1.5 Plugin to implement A List Apart's Automatic Ma

Posted: Sun Dec 23, 2007 2:43 am
by AmyStephen
Sander -

Image

Very, very nice! :)

Pull those style tags out and place them into a file - then include the file within your php file.

Code: Select all

	// Add CSS
	$document =& JFactory::getDocument();
	$document->addStyleSheet( JURI::base() . 'plugins/content/slimbox.css', 'text/css', null, array( ' id' => 'StyleSheet' ) );
These two files can be copied into a folder named magazinelayout:

Code: Select all

		<filename plugin="magazinelayout">magazinelayout.image.php</filename>
		<filename plugin="magazinelayout">magazinelayout.class.php</filename>
Usually, if it's just the php, xml, css and 1 js file, they can all stay in the root of the content plugins - but if there is more than that, creating a folder can be helpful. You could add your css to that folder, if you choose.

This is a beauty - there is no doubt. What a great way to take a set of up to eight images and turn it into a perfectly arranged gallery. This has the potential of dressing up many J! sites.

I love how you allow the image manager to be used. You need to consider, though, that a lot of HTML is going to slip in there between the images. When that happens, the site bombs hard.

When we used a NoWYSIWYG editor - it only recognized the first image - experimenting more, it appeared that paragraph tags around the images created a perfect feed to your program.

Give it some thought how you can handle the inexperienced user with the editor - and the noWYSIWYG editor. At bare minimum, make it perfectly obvious in the instructions what that HTML should look like inside of the plugin.

This is a wonderful, wonderful, wonderful plugin. People are going to love it. Thanks for taking the task. We'll look for your next post!

Amy :)

Re: 130 - Create a Joomla! v 1.5 Plugin to implement A List Apart's Automatic Ma

Posted: Mon Dec 24, 2007 11:13 am
by SanderKromwijk
Hi,

Here is the plugin. I saw that I had made a mistake with the pargraph thing. It is not necessery to put any delimiters anymore, only the two {images} tags. I can't test the plugin because I'm not on my own computer (I'm on vacation), so I hope I did not make any coding errors. I've also written a part in the documentation for the people who don't use wysiwyg editors. The two php files and the css file are in another directory.

Sander Kromwijk

Re: 130 - Create a Joomla! v 1.5 Plugin to implement A List Apart's Automatic Ma

Posted: Mon Dec 24, 2007 11:14 am
by SanderKromwijk
Hi,

I forgot to attach the file, here it is:

Sander Kromwijk

Re: 130 - Create a Joomla! v 1.5 Plugin to implement A List Apart's Automatic Ma

Posted: Mon Dec 24, 2007 12:06 pm
by mcsmom
Sander,

I uninstalled and tried to reinstall ... I got this error:



        * JInstaller::install: File '/home/xxxx/public_html/rc4/tmp/install_476f9ffeb932b/plg_magazinelayout/magazinelayout.image.php' does not exist

Message

Re: 130 - Create a Joomla! v 1.5 Plugin to implement A List Apart's Automatic Ma

Posted: Wed Dec 26, 2007 5:52 am
by AmyStephen
I had the same problem as mcsmom.

Try this for your xml file:


Content - Magazine Layout
Sander Kromwijk
December 2007
Sander Kromwijk. All rights reserved.
http://www.gnu.org/licenses/gpl-2.0.html GNU/GPL
[email protected]

1.0
Plugin which implements a Magazine Layout

magazinelayout.php
MagazineLayout





en-GB.plg_content_magazinelayout.ini

Re: 130 - Create a Joomla! v 1.5 Plugin to implement A List Apart's Automatic Ma

Posted: Fri Dec 28, 2007 1:48 pm
by SanderKromwijk
Hi,

I tried to correct the problem, but since the new version RC4 it doesn't work anymore. Did the event names change?

Sander Kromwijk

Re: 130 - Create a Joomla! v 1.5 Plugin to implement A List Apart's Automatic Ma

Posted: Fri Dec 28, 2007 2:05 pm
by SanderKromwijk
Sorry,

I forgot the / in the ending tag  :-[

Sander Kromwijk

Re: 130 - Create a Joomla! v 1.5 Plugin to implement A List Apart's Automatic Ma

Posted: Fri Dec 28, 2007 2:37 pm
by SanderKromwijk
Hi,

Here is the corrected version. I have been able to test it this time, so now I'm sure it works. Unless something is missing, this is the final version.

Sander Kromwijk

Re: 130 - Create a Joomla! v 1.5 Plugin to implement A List Apart's Automatic Ma

Posted: Fri Dec 28, 2007 9:59 pm
by jlleblanc
Looks good over all, here are a few comments:

You can get rid of the second loop by using this regex to find all single and double quotes:

Code: Select all

$regex = '/src=["\'](.*)["\']/iU';
Note that the \ inside of the character class is escaping the single quote for the string and not for the regex.

I'm looking for a way around hand editing the images to get the paths right. Here's my solution so far. Before you get to the loop, build the path to strip:

Code: Select all

$uri =& JFactory::getURI();
$path = '../..' . str_replace('~', '%7E', $uri->getPath());
Inside the loop right before you add the match to the array, strip out this path if it exists:

Code: Select all

if (stristr($matches[1][$i], $path)) {
	$matches[1][$i] = str_replace($path, '', $matches[1][$i]);
}
This solution isn't ideal, but it works on my end. The whole str_replace('~', '%7E', $uri->getPath()); bit is my way of escaping the ~ character (which is a part of the URL I'm testing this from). A more robust solution would be to split the result of $uri->getPath() on /, urlencode() the pieces, then join them up again. This will at least fix it for the editor that ships with Joomla! (TinyMCE). It would also be better if I didn't prepend the '../..' bit to the beginning; you can probably write a preg_replace() regex to ignore everything before the urlencoded version of $uri->getPath();


I would definitely implement the first of these two so you don't have to do two separate loops for both kinds of quotes. The second part is trickier, but would definitely improve the usability of the plugin.

Re: 130 - Create a Joomla! v 1.5 Plugin to implement A List Apart's Automatic Ma

Posted: Tue Jan 01, 2008 9:26 pm
by SanderKromwijk
Hi,

I corrected the things you said. Is it OK now?

Sander Kromwijk

Re: 130 - Create a Joomla! v 1.5 Plugin to implement A List Apart's Automatic Ma

Posted: Wed Jan 02, 2008 3:03 pm
by jlleblanc
Yes, it looks great! I'm going to say this is done, but I'll let one of the other judges take a look and give feedback.

Re: 130 - Create a Joomla! v 1.5 Plugin to implement A List Apart's Automatic Ma

Posted: Thu Jan 03, 2008 1:27 am
by AmyStephen
I love this, very, very much and can't wait to start seeing it on some sites. I mean, how easy can things get? WOW!

I also accept this as complete. Please upload to the Google Task Page. When you have done so, we will mark it complete there, as well, and you will be free to choose another task, if you wish.

Thank you for your contributions to the Joomla! community,
Amy :)