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

Google's Highly Open Participation Program tries to get young students into Open Source and Joomla! specifically. Everyone is welcome, there are not limits. You can be a coder, documenter, tester, translator to help out. Jump in and start helping!
User avatar
SanderKromwijk
Joomla! Intern
Joomla! Intern
Posts: 68
Joined: Thu Dec 13, 2007 2:59 pm

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

Postby SanderKromwijk » Tue Dec 18, 2007 4:04 pm

Hi,

I'm the one who did task number 127

Sander Kromwijk
Last edited by AmyStephen on Thu Jan 03, 2008 1:34 am, edited 1 time in total.
Simple and elegant messaging. Download the Messaging extension for Joomla! See http://extensions.joomla.org/extensions/4026/details

User avatar
jlleblanc
Joomla! Guru
Joomla! Guru
Posts: 963
Joined: Fri Aug 19, 2005 12:37 am
Location: Washington, DC / NoVA
Contact:

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

Postby jlleblanc » Tue Dec 18, 2007 5:54 pm

Excellent! Looking forward to more of your code  ;D
Joseph L. LeBlanc: http://www.jlleblanc.com
Frontend components start here: /components/com_[name]/[name].php
Backend components start here: /administrator/components/com_[name]/admin.[name].php

User avatar
SanderKromwijk
Joomla! Intern
Joomla! Intern
Posts: 68
Joined: Thu Dec 13, 2007 2:59 pm

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

Postby SanderKromwijk » Thu Dec 20, 2007 7:25 pm

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
You do not have the required permissions to view the files attached to this post.
Simple and elegant messaging. Download the Messaging extension for Joomla! See http://extensions.joomla.org/extensions/4026/details

User avatar
SanderKromwijk
Joomla! Intern
Joomla! Intern
Posts: 68
Joined: Thu Dec 13, 2007 2:59 pm

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

Postby SanderKromwijk » Sat Dec 22, 2007 8:57 pm

Hi,

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

Sander Kromwijk
You do not have the required permissions to view the files attached to this post.
Simple and elegant messaging. Download the Messaging extension for Joomla! See http://extensions.joomla.org/extensions/4026/details

User avatar
mcsmom
Joomla! Exemplar
Joomla! Exemplar
Posts: 7985
Joined: Thu Aug 18, 2005 8:43 pm
Location: New York
Contact:

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

Postby mcsmom » Sun Dec 23, 2007 2:43 am

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.  :)
So we must fix our vision not merely on the negative expulsion of war, but upon the positive affirmation of peace. MLK 1964.
http://officialjoomlabook.com Get it at http://www.joomla.org/joomla-press-official-books.html Buy a book, support Joomla!.

AmyStephen
Joomla! Champion
Joomla! Champion
Posts: 7056
Joined: Wed Nov 22, 2006 3:35 pm
Location: Nebraska
Contact:

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

Postby AmyStephen » Sun Dec 23, 2007 2:43 am

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 :)

User avatar
SanderKromwijk
Joomla! Intern
Joomla! Intern
Posts: 68
Joined: Thu Dec 13, 2007 2:59 pm

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

Postby SanderKromwijk » Mon Dec 24, 2007 11:13 am

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
Simple and elegant messaging. Download the Messaging extension for Joomla! See http://extensions.joomla.org/extensions/4026/details

User avatar
SanderKromwijk
Joomla! Intern
Joomla! Intern
Posts: 68
Joined: Thu Dec 13, 2007 2:59 pm

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

Postby SanderKromwijk » Mon Dec 24, 2007 11:14 am

Hi,

I forgot to attach the file, here it is:

Sander Kromwijk
You do not have the required permissions to view the files attached to this post.
Simple and elegant messaging. Download the Messaging extension for Joomla! See http://extensions.joomla.org/extensions/4026/details

User avatar
mcsmom
Joomla! Exemplar
Joomla! Exemplar
Posts: 7985
Joined: Thu Aug 18, 2005 8:43 pm
Location: New York
Contact:

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

Postby mcsmom » Mon Dec 24, 2007 12:06 pm

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
So we must fix our vision not merely on the negative expulsion of war, but upon the positive affirmation of peace. MLK 1964.
http://officialjoomlabook.com Get it at http://www.joomla.org/joomla-press-official-books.html Buy a book, support Joomla!.


User avatar
SanderKromwijk
Joomla! Intern
Joomla! Intern
Posts: 68
Joined: Thu Dec 13, 2007 2:59 pm

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

Postby SanderKromwijk » Fri Dec 28, 2007 1:48 pm

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
Simple and elegant messaging. Download the Messaging extension for Joomla! See http://extensions.joomla.org/extensions/4026/details

User avatar
SanderKromwijk
Joomla! Intern
Joomla! Intern
Posts: 68
Joined: Thu Dec 13, 2007 2:59 pm

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

Postby SanderKromwijk » Fri Dec 28, 2007 2:05 pm

Sorry,

I forgot the / in the ending tag  :-[

Sander Kromwijk
Simple and elegant messaging. Download the Messaging extension for Joomla! See http://extensions.joomla.org/extensions/4026/details

User avatar
SanderKromwijk
Joomla! Intern
Joomla! Intern
Posts: 68
Joined: Thu Dec 13, 2007 2:59 pm

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

Postby SanderKromwijk » Fri Dec 28, 2007 2:37 pm

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
You do not have the required permissions to view the files attached to this post.
Simple and elegant messaging. Download the Messaging extension for Joomla! See http://extensions.joomla.org/extensions/4026/details

User avatar
jlleblanc
Joomla! Guru
Joomla! Guru
Posts: 963
Joined: Fri Aug 19, 2005 12:37 am
Location: Washington, DC / NoVA
Contact:

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

Postby jlleblanc » Fri Dec 28, 2007 9:59 pm

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.
Joseph L. LeBlanc: http://www.jlleblanc.com
Frontend components start here: /components/com_[name]/[name].php
Backend components start here: /administrator/components/com_[name]/admin.[name].php

User avatar
SanderKromwijk
Joomla! Intern
Joomla! Intern
Posts: 68
Joined: Thu Dec 13, 2007 2:59 pm

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

Postby SanderKromwijk » Tue Jan 01, 2008 9:26 pm

Hi,

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

Sander Kromwijk
You do not have the required permissions to view the files attached to this post.
Simple and elegant messaging. Download the Messaging extension for Joomla! See http://extensions.joomla.org/extensions/4026/details

User avatar
jlleblanc
Joomla! Guru
Joomla! Guru
Posts: 963
Joined: Fri Aug 19, 2005 12:37 am
Location: Washington, DC / NoVA
Contact:

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

Postby jlleblanc » Wed Jan 02, 2008 3:03 pm

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.
Joseph L. LeBlanc: http://www.jlleblanc.com
Frontend components start here: /components/com_[name]/[name].php
Backend components start here: /administrator/components/com_[name]/admin.[name].php

AmyStephen
Joomla! Champion
Joomla! Champion
Posts: 7056
Joined: Wed Nov 22, 2006 3:35 pm
Location: Nebraska
Contact:

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

Postby AmyStephen » Thu Jan 03, 2008 1:27 am

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 :)


Return to “Google's Highly Open Participation Contest”

Who is online

Users browsing this forum: No registered users and 0 guests