content plugin from my custom component - gallery

Discussion and education for beginner / novice programmers interested in embarking on the development process to take advantage of the extensible nature of the Joomla! CMS.
Locked
patterncatcher
Joomla! Intern
Joomla! Intern
Posts: 81
Joined: Tue Jan 02, 2007 2:42 pm

content plugin from my custom component - gallery

Post by patterncatcher » Fri Jun 06, 2008 1:07 pm

I am trying to call Simple Image gallery in my component,
It is a content plugin that looks for { gallery }foldername{ /gallery } in an article and put the images for the folder there.
How can I call a content plugin from my component?

g00s3m4n
Joomla! Apprentice
Joomla! Apprentice
Posts: 22
Joined: Mon Aug 28, 2006 5:12 pm

Re: content plugin from my custom component - gallery

Post by g00s3m4n » Mon Aug 25, 2008 12:31 am

Hello,

Have you had any success?
I am attempting the same thing and have not been able to find a solution.

Thanks,

patterncatcher
Joomla! Intern
Joomla! Intern
Posts: 81
Joined: Tue Jan 02, 2007 2:42 pm

Re: content plugin from my custom component - gallery

Post by patterncatcher » Mon Aug 25, 2008 1:23 pm

I created my own solution using jquery lightbox.
Download both, and call scripts from document.
You may need to use noconflict for jquery if you are also using mootools, google it.

Javascript (put in document header)

Code: Select all

$(document).ready(function() {
$('a[@rel*=lightbox]').lightBox();
}
then in the php:

In Images/stories I created a folder called theimagefolder, inside of which are folders with name of id of database entry ($row->id) then put the code in the components .html.php file:

Code: Select all

$dir = JPATH_SITE.'/images/stories/theimagefolder/'.$row->id; // 
	
   	// open specified directory
  	 $dirHandle = opendir($dir);
		while ($file = readdir($dirHandle)) {
      // if not a subdirectory and if filename contains the string '.jpg' 
      if(!is_dir($file) && strpos($file, '.jpg')>0) {
         // update count and string of files to be returned
		 $imgurl= $live_site."images/stories/theimagefolder/".$row->id."/".$file;
		 ?>
		 <a  rel="lightbox" href = "<? echo $imgurl; ?>" title="Your title" ><img src ="<? echo $imgurl; ?>" alt="Your alt"   width="100" height="70"  /></a>
		 
		 <?
         
		 $count++;
         echo $ourlink;
      	}
   	} 
   closedir($dirHandle);

Hope this helps


Locked

Return to “Joomla! Coding 101”