Page 2 of 3

Re: 138 - Create a Joomla! v 1.5 Slideshare Module

Posted: Sat Dec 15, 2007 11:28 pm
by AmyStephen
Description - still says: A module to view SlideShare presentations.

In the description, need to give detailed explanation of how to use plugin - with examples of different options for user, tag and group.

I do not know how to use this - I tried {SlideShare user=AmyStephen}, but it did not work. (In fact, those values were not removed from the article when I viewed the frontend, and the plugin is enabled.)

$total_poss_slides and $content; not initialized in code;

lowercase --> {SlideShare (2 places)

allow sizing of object - might be best to allow the width to be set - you calculate height. That way, you can keep it proportional, and still allow users to control what most impacts their site - the width.
// Load the Javascript and CSS
$document->addScript( '/joomla/plugins/content/slideshare//javascript.js' );
$document->addStyleSheet( '/joomla/plugins/content/slideshare//css.php?bg_color_1=' . $output->bg_color_1 . etc..
Let me guess...you have installed in a subdirectory named Joomla!?  ;)

Look at the examples I gave above - addScript( JURI::base()

This should be moduled after loadmodule - which fires on prepare content. Copy loadmodule and try to structure your code exactly like that.

I don't think it's quite ready yet. Let me know how to use it - again, try to get those instructions into the description. I'll look for your next post.

Thanks!
Amy :)

Re: 138 - Create a Joomla! v 1.5 Slideshare Module

Posted: Sun Dec 16, 2007 3:22 am
by jgirata
Ok, I was able to fix most of the things that you mentioned, but I do have a few questions.

First, the instructions for using this, with examples and such, is pretty long.  I tried to use HTML formatting in the tag, but when I use a little bit, it's ignored, and when I use a lot, I get an error when installing.  I looked in some of the other plugins that have HTML in their descriptions, but they all use language files to put it in.  Is there any way that I can add HTML without using language files?  I checked on dev.joomla.org, but wasn't able to find anything.  In the meantime, I've created a README.txt file, and included it in the zip (it's not installed with the plugin, though).  In the description, I just said to go read that file.

Second, do you want it to be {slideshare ...} instead of {SlideShare ...} ?  I only capitalized it as that is the way that it is on their website.

I'm finishing up the code to modify the width and height, so once I'm done with that, I'll upload the modified code.

Edit: Ok, I made the suggested changes (except for the two noted above).  Attached is the updated code.

Re: 138 - Create a Joomla! v 1.5 Slideshare Module

Posted: Sun Dec 16, 2007 6:24 am
by AmyStephen
{SlideShare User AmyStephen 0}

That builds the box - with this text, below - but nothing else.
User: AmyStephen          Current Slide:
Total Slides: 0
Also, name your article SlideShare and see if the title "goes away."

Sorry to be your first "stupid user!"  :P

I'll watch for your response,
Amy :)

Re: 138 - Create a Joomla! v 1.5 Slideshare Module

Posted: Mon Dec 17, 2007 1:05 am
by jgirata
As I was going through the SlideShare documentation looking for info about setting the limit to 0, I found that you are only allowed to send 1000 API requests per day from each key (and all the plugins would use my key).  Since I figured that 1000 requests could add up pretty quickly, so I have it now writing everything that is retrieved from the SlideShare server to the MySQL database, and updating every 24 hours.  If, by some act of God, there are more than 1000 unique requests per day, then I'll just sign up for another SlideShare developer key, and change it in the download :P

Anyway, that's why I haven't just corrected the issues you posted.  I'm still testing and debugging this.  I'll post the code after I've played with it a little longer.

Re: 138 - Create a Joomla! v 1.5 Slideshare Module

Posted: Thu Dec 20, 2007 8:46 pm
by jgirata
Ok, everything works.  The only problem I'm having is with the install.sql and uninstall.sql files.  I created them, and modified the slideshare.xml install file correctly (I think), but it's not running the SQL.  I think I did everything that they did in the tutorial, but it's still not working.  Attached is the updated code.  Any help would be highly appreciated :)

P.S.  Sorry it's been so long.  I had this done a few days ago, but I just had a band concert yesterday, so we've been having extra practices and stuff to get ready, so I didn't have much time  :-\

Edit:  I just updated my code to Joomla! v1.5 RC4, and found a bug that was preventing the parameters from loading.  I didn't see it when I had RC3, so I guess it was from a change in the code.  Either way, I've updated the download, and it's fixed.  Now, my only problem is the install.sql file :-\

Re: 138 - Create a Joomla! v 1.5 Slideshare Module

Posted: Sat Dec 22, 2007 4:04 pm
by jgirata
Bump?  Anyone able to help?

Re: 138 - Create a Joomla! v 1.5 Slideshare Module

Posted: Sat Dec 22, 2007 11:41 pm
by mcsmom
I'll take a look ... no promises I'll know what's happening though.  :)


It installed smoothly for me, but it gave me a parse error when i went to the front end. It references line 11, but it's doubtful the problem is there.

I think the problem may be that the sql files have to be in the administrator ... there was a post about that earlier.


http://forum.joomla.org/index.php/topic ... msg1122557

Also, I believe in your xml file you have uninstall with 2 Ls but the file name you have is uninstal.sql.

Re: 138 - Create a Joomla! v 1.5 Slideshare Module

Posted: Sun Dec 23, 2007 1:23 am
by AmyStephen
John -

On my localhost, this works with your example code: {SlideShare tag creative 25}

+++

I am still getting the same error when I use {SlideShare User AmyStephen 0}:

Image

+++

On my hosted solution, using your example from readme: {SlideShare tag creative 25} the code from the plugin is being displayed on the webpage - even when the plugin is not in use:

Image

+++

John - I'm crushed here for you! You had this going so well! Somewhere after December 11 and before the last time I tested, I think changes were made that are causing problems. There are a couple of local variables ($values, $tags) not initialized in RSStoArray.

In slideshare.php $content has not been initialized:

Code: Select all

$row->text = preg_replace('/' . $matches[0][$i] . '/i', $content, $row->text);
You have two // in this line:

Code: Select all

		$document->addStyleSheet( JURI::base() . 'plugins/content/slideshare//css.php?bg_color_1=' . $output->bg_color_1 . '&bg_color_2=' . $output->bg_color_2 . '&border_color='. $output->border_color . '&width=' . $output->width . '&height=' . $output->height, 'text/css', null, array( ' id' => 'StyleSheet' ) );
In plgSlideShareChangeDimensions function, $width3 and $height3 are not initialized.

Not sure what to say...do you happen to have a copy of the file from the 11th?

I'll try to look for your post.
Amy :)

Re: 138 - Create a Joomla! v 1.5 Slideshare Module

Posted: Sun Dec 23, 2007 2:28 am
by jgirata
I can just download the ZIP that was attached to the post before I started changing everything.  The problem is that SlideShare only lets you make 1000 API calls per day, so I have to store everything in the database.  Everything seems to work fine for me from a fresh install... even after I completely deleted Joomla and dropped the database when I installed RC4.

I still can't get the install.sql file to load.

Re: 138 - Create a Joomla! v 1.5 Slideshare Module

Posted: Fri Dec 28, 2007 5:54 am
by AmyStephen
jgirata -

Where are you at on this task? Still working on this?

When you say you are unable to get install.sql to load, what do you mean?

Thanks,
Amy :)

Re: 138 - Create a Joomla! v 1.5 Slideshare Module

Posted: Fri Dec 28, 2007 3:47 pm
by jgirata
Sorry for the inactivity.  I've been busy with the holiday and stuff, and wasn't able to get on.  I rewrote a good bit of the code, and reorganized it all, so that it's easier to work with.  I'm just having a problem with the SlideShare API when I try to get presentations by group.

About install.sql:  when I install the plugin, the SQL in the install.sql file isn't running.  It (Joomla!) says that the plugin installed correctly, but the new table isn't created.  Attached is the latest version of my code.  Everything except filtering by group and the install SQL works for me.  Here is the SQL to run if you want to manually edit your database.

Code: Select all

DROP TABLE IF EXISTS `jos_plgslideshare`;

CREATE TABLE `jos_plgslideshare` (
	`time` VARCHAR( 10 ) NOT NULL ,
	`type` TEXT NOT NULL ,
	`value` TEXT NOT NULL ,
	`limit` TEXT NOT NULL ,
	`total_slides` TEXT NOT NULL ,
	`slide_titles` TEXT NOT NULL ,
	`first_embed_code` TEXT NOT NULL ,
	`first_slide_title` TEXT NOT NULL ,
	`label` TEXT NOT NULL
) ENGINE = MYISAM;
I'm running this on my computer using XAMPP.  I'm going to install Joomla! on my server later today, though, and see how it holds up there (I hope there's no difference, but with my luck, there will be plenty).

Re: 138 - Create a Joomla! v 1.5 Slideshare Module

Posted: Tue Jan 01, 2008 3:05 am
by AmyStephen
I pm'ed someone to see if he can help with the install question.

Thanks!
Amy :)

Re: 138 - Create a Joomla! v 1.5 Slideshare Module

Posted: Tue Jan 01, 2008 5:46 am
by jlleblanc
Hi there,

The short answer is that modules and plugins cannot run SQL files on installation the way you can do with components. However, there may be some ways around that we can look at. I'll take a closer look at your code tomorrow and get back to you.

Re: 138 - Create a Joomla! v 1.5 Slideshare Module

Posted: Tue Jan 01, 2008 4:15 pm
by jlleblanc
AmyStephen wrote:
On my hosted solution, using your example from readme: {SlideShare tag creative 25} the code from the plugin is being displayed on the webpage - even when the plugin is not in use:

Image
This issue looks like a quick fix: it's very likely that Amy's host has short tags turned off. Change <? to <?php and the problem should clear up.

Re: 138 - Create a Joomla! v 1.5 Slideshare Module

Posted: Tue Jan 01, 2008 6:08 pm
by jlleblanc
Now that I've had a chance to look things over, I have a few suggestions. Even though it would be easier for people to use your account without getting their own API key, I think the folks at SlideShare would rather people get their own. If someone started to abuse your plugin (or even just the key), they might shut down your account and you'd be out of luck. You can use backend parameters to store the key and include some documentation to walk people through the process of getting one.

You might try caching the information on the filesystem instead of using the DB. The quickest way of doing this would be to use PHP's serialize() function to get a string representation of an array of data, writing it to a file, then reading it back using unserialize().

If you still want to use database caching, I would like to get the other judges feedback on allowing a component to be a part of the project. While you could code the plugin to check to see if the database table is there before doing the cache (adding it if it isn't), this still wouldn't provide a way of deleting the table on uninstallation. I've used components and plugins together in this way before. Although it does create another package that end users have to install, it's the cleanest way of getting this project done "correctly."

Any project involving a 3rd party service always adds an additional layer that you have to test and work with. You're doing a good job with it.  :)

Re: 138 - Create a Joomla! v 1.5 Slideshare Module

Posted: Wed Jan 02, 2008 7:01 pm
by jgirata
Ok, I've changed it so that it stores all the information to plgSlideShare/cache.txt instead of the database.  It writes correctly, but when I try to get the array out of the file with unserialize(), I get this error message:
Warning: unserialize() [function.unserialize]: Node no longer exists in C:\xampp\htdocs\joomla\plugins\content\plgSlideShare.php on line 165
I've looked up the error message, and it says that that's a common error when working with SimpleXML objects, it never mentions arrays.

Here's lines 160 - 165:

Code: Select all

$file = file('plugins/content/plgSlideShare/cache.txt');
foreach($file as $line)
{
	$parts = explode('		', $line);
	$timestamp = (int)$parts[0];
	$array = unserialize($parts[1]);
Any ideas?

Attached is the (mostly) updated fie.

Re: 138 - Create a Joomla! v 1.5 Slideshare Module

Posted: Thu Jan 03, 2008 7:35 am
by AmyStephen
The error Joe talked about being related to the tag is now gone.  8)

How do I get an API key so that I can continue testing?

Thanks!
Amy :)

Edit:
To get an API Key - http://www.slideshare.net/developers/applyforapi

Re: 138 - Create a Joomla! v 1.5 Slideshare Module

Posted: Sun Jan 06, 2008 12:33 am
by jlleblanc
Hi John,

I tested the new code with my API key and have some suggestions. First, be sure to turn on PHP notices. On the first load, line 177 throws a notice because $old_lines isn't initialized. Move line 166 to 161 and the notice will go away.

As far as the process goes, you could put your cache timestamp into the array with everything else, which will help you avoid needing a foreach() and explode(). You can use multidimensional associative arrays here to your advantage. Instead of appending each new slide to the end of the cache file, unserialize the existing array and add to it.

Re: 138 - Create a Joomla! v 1.5 Slideshare Module

Posted: Tue Jan 08, 2008 6:14 am
by AmyStephen
You know, I'm not even certain where we are at with this task, anymore. It was looking so good right away.

jgirata - Are you nearing the end? Please let us know if there is something we can do to help.

Thanks!
Amy :)

Re: 138 - Create a Joomla! v 1.5 Slideshare Module

Posted: Fri Jan 11, 2008 9:59 pm
by jgirata
Sorry, we were in the middle of finals.  I have two problems... getting info by groups using the API, and using the serialize.  I hope to rectify both those issues tonight.

Re: 138 - Create a Joomla! v 1.5 Slideshare Module

Posted: Fri Jan 18, 2008 8:38 pm
by mcsmom
You mentioned this before, but i would urge you to lower case slideshare. People are much less likely to make mistakes that way.

Re: 138 - Create a Joomla! v 1.5 Slideshare Module

Posted: Sun Jan 20, 2008 10:15 pm
by jgirata
I've gotten everything to work except being able to retrieve slides by group; the API still won't bring back the information.  If it's alright with you guys, I'd like to just drop that feature.

Attached is my updated code.

Re: 138 - Create a Joomla! v 1.5 Slideshare Module

Posted: Mon Jan 21, 2008 7:45 am
by AmyStephen
jgirata - certainly, that's fine to skip the group at this time.

I cannot seem to find my key from previous testing - or - to get slideshare to send it to me.

Would someone please PM me their key for testing? Then, we can get this finalized! :P

Also, jgirata - if you don't already have a JoomlaCode repository, please get one and post the URL on your Google Task sheet. They don't have more space for us - so - we are just posting links when we close a task

Tomorrow is the last day to claim a new task. I'll look for this key to get moving.

Thanks!
Amy :)

Re: 138 - Create a Joomla! v 1.5 Slideshare Module

Posted: Mon Jan 21, 2008 10:16 pm
by jgirata
I have a JoomlaCode account somewhere.  I'll have to find it and upload the code to that.  Also, I've PMed you my key.

Edit:  No I didn't.  It says your inbox if full.

Re: 138 - Create a Joomla! v 1.5 Slideshare Module

Posted: Mon Jan 21, 2008 10:26 pm
by AmyStephen
Try me again - deleted a few pieces.  :P

Re: 138 - Create a Joomla! v 1.5 Slideshare Module

Posted: Mon Jan 21, 2008 10:46 pm
by jgirata
Ok, it sent :)

Re: 138 - Create a Joomla! v 1.5 Slideshare Module

Posted: Tue Jan 22, 2008 3:30 am
by AmyStephen
I cannot get this to run.

This syntax is from your readme. Is that correct?

{SlideShare tag creative 25}

Re: 138 - Create a Joomla! v 1.5 Slideshare Module

Posted: Tue Jan 22, 2008 3:45 am
by AmyStephen
Finally! The syntax has been changed to lowercase.

Go ahead and update your Readme file - upload the zip file to your Google page - and I'll mark this closed.

I am sorry for all the trouble you have had with the API issues. This is a really cool extension and it's one I plan to use. It's a great way to share a lot of resources on your site quickly, that your visitors will find interesting.

I hope you also have a JoomlaCode and Joomla! Extension Directory listing. I'd like to the JED link, when you get it, so post it back here if you choose.

Thanks so much for your considerable work, your patience, your wonderful attitude, and for providing the Joomla! community with easy access to SlideShare!

Amy :)

Re: 138 - Create a Joomla! v 1.5 Slideshare Module

Posted: Tue Jan 22, 2008 10:33 pm
by jgirata
Well, I created an account on Joomla! Code a while ago, but I can't figure out how to upload files.  I have a project created, and I can access the admin area, but I don't know how to upload.

Re: 138 - Create a Joomla! v 1.5 Slideshare Module

Posted: Wed Jan 23, 2008 2:20 pm
by jlleblanc
jgirata wrote: Well, I created an account on Joomla! Code a while ago, but I can't figure out how to upload files.  I have a project created, and I can access the admin area, but I don't know how to upload.
After you create a project, you also have to create a release. Once you've added a release, you can upload files.