Shared tags

For questions and problems with the CMS core. This board is NOT for any 3rd party modules, addons, PHP scripts or anything NOT distributed with the CMS made simple package itself.
Post Reply
User avatar
Dr.CSS
Moderator
Moderator
Posts: 12711
Joined: Thu Mar 09, 2006 5:32 am

Shared tags

Post by Dr.CSS »

Elijah
can the  table_of_contents tag be made to look in a folder of images and spit out a of the images?...
User avatar
Elijah Lofgren
Power Poster
Power Poster
Posts: 811
Joined: Mon Apr 24, 2006 1:01 am

Re: Shared tags

Post by Elijah Lofgren »

mark wrote: Elijah
can the  table_of_contents tag be made to look in a folder of images and spit out a of the images?...
This code will list all files in the uploads/images/ folder.

Code: Select all

global $gCms;
$dir = $gCms->config['root_path'] . DIRECTORY_SEPARATOR .'uploads/images/';

echo 'this is the dir:'.$dir;
echo '<ul>';
// Open a known directory, and proceed to read its contents
if (is_dir($dir)) {
	if ($dh = opendir($dir)) {
		while (($file = readdir($dh)) !== false) {
                     if ('file' == filetype($dir . $file)) {
			echo "<li>filename: $file </li>\n";
                    }
       }
       closedir($dh);
   }
}
echo '</ul>';
Note: I don't have time to take on any more projects. I'm quite busy. I may be too busy to reply to emails or messages. Thanks for your understanding. :)
User avatar
Dr.CSS
Moderator
Moderator
Posts: 12711
Joined: Thu Mar 09, 2006 5:32 am

Re: Shared tags

Post by Dr.CSS »

i take it this is a UDT...
can i change this line to look in diff. folder..
$dir = $gCms->config['root_path'] . DIRECTORY_SEPARATOR .'uploads/images/';

like so...
$dir = $gCms->config['root_path'] . DIRECTORY_SEPARATOR .'uploads/images/gallery1';

oh yea where do i put this...
and what happened when i submitted this post 2 new things showed up across the top... a check mark and X graphic
Last edited by Anonymous on Wed May 31, 2006 3:25 pm, edited 1 time in total.
User avatar
Elijah Lofgren
Power Poster
Power Poster
Posts: 811
Joined: Mon Apr 24, 2006 1:01 am

Re: Shared tags

Post by Elijah Lofgren »

mark wrote: i take it this is a UDT...
can i change this line to look in diff. folder..
$dir = $gCms->config['root_path'] . DIRECTORY_SEPARATOR .'uploads/images/';

like so...
$dir = $gCms->config['root_path'] . DIRECTORY_SEPARATOR .'uploads/images/gallery1';

oh yea where do i put this...
and what happened when i submitted this post 2 new things showed up across the top... a check mark and X graphic


Yes it's a User defined tag. Yes you can change the folder. Just make a new user defined tag and call it like normal. No idea about the check mark and X graphic.
Note: I don't have time to take on any more projects. I'm quite busy. I may be too busy to reply to emails or messages. Thanks for your understanding. :)
User avatar
Dr.CSS
Moderator
Moderator
Posts: 12711
Joined: Thu Mar 09, 2006 5:32 am

Re: Shared tags

Post by Dr.CSS »

Cool....
can it do this.... maybe?



  thanks
User avatar
Elijah Lofgren
Power Poster
Power Poster
Posts: 811
Joined: Mon Apr 24, 2006 1:01 am

Re: Shared tags

Post by Elijah Lofgren »

mark wrote: Cool....
can it do this.... maybe?



  thanks
You're welcome, thanks for saying thanks.  :)

This should do it.

Code: Select all

global $gCms;
$dir = $gCms->config['root_path'] . DIRECTORY_SEPARATOR .'uploads/images/gallery1/';
$url = './uploads/images/gallery1/';
echo '<ul>';
// Open a known directory, and proceed to read its contents
if (is_dir($dir)) {
	if ($dh = opendir($dir)) {
		while (($file = readdir($dh)) !== false) {
                     if ('file' == filetype($dir . $file)) {
$pos = strpos($file, '.');
// Note our use of ===.  Simply == would not work as expected
// because the position of 'a' was the 0th (first) character.
if ($pos === false) {
//   echo "The string '$findme' was not found in the string '$mystring'";
} else {
$name = substr($file, 0, $pos);
$extension = substr($file, $pos);
echo "<li><a href=".$url.$file.'" rel="lightbox"><img src="'.$url.$name.'_thumb'.$extension.'" /></a>'."</li>\n";
}

			
                    }
       }
       closedir($dh);
   }
}
echo '</ul>';
Version that outputs thumb_vacation1.jpg format here (like CMSMS uses):  http://wiki.cmsmadesimple.org/index.php ... stpictures
Last edited by Anonymous on Fri Jun 02, 2006 2:33 am, edited 1 time in total.
Note: I don't have time to take on any more projects. I'm quite busy. I may be too busy to reply to emails or messages. Thanks for your understanding. :)
User avatar
Dr.CSS
Moderator
Moderator
Posts: 12711
Joined: Thu Mar 09, 2006 5:32 am

Re: Shared tags

Post by Dr.CSS »

man that's real close want to see what you made  http://www.multiintech.com/index.php?page=image_gallery
the gallery already has thumbs so somethings are repeated with thumbs_thumbs.jpg but i'm hoping to figure it out...

  thanks again you da man!!  :D
User avatar
Elijah Lofgren
Power Poster
Power Poster
Posts: 811
Joined: Mon Apr 24, 2006 1:01 am

Re: Shared tags

Post by Elijah Lofgren »

mark wrote: man that's real close want to see what you made  http://www.multiintech.com/index.php?page=image_gallery
the gallery already has thumbs so somethings are repeated with thumbs_thumbs.jpg but i'm hoping to figure it out...

  thanks again you da man!!  :D
You're welcome.  ;D

This code should do it:

Code: Select all

global $gCms;
$dir = $gCms->config['root_path'] . DIRECTORY_SEPARATOR .'uploads/images/gallery1/';
$url = './uploads/images/gallery1/';
echo '<ul>';
// Open a known directory, and proceed to read its contents
if (is_dir($dir)) {
        if ($dh = opendir($dir)) {
                while (($file = readdir($dh)) !== false) {
                     if ('file' == filetype($dir . $file)) {
$thumb1_pos = strpos($file, 'thumb_');
$thumb2_pos = strpos($file, '_thumb');
$pos = strpos($file, '.');
$extension = substr($file, $pos);
if ($thumb1_pos === false && '.jpg' == $extension && $thumb2_pos === false) {
// Note our use of ===.  Simply == would not work as expected
// because the position of 'a' was the 0th (first) character.
if ($pos === false) {
//   echo "The string '$findme' was not found in the string '$mystring'";
} else {
$name = substr($file, 0, $pos);
echo '<li><a href="'.$url.$file.'" rel="lightbox"><img src="'.$url.$name.'_thumb'.$extension.'" /></a>'."</li>\n";
}
}
                        
                    }
       }
       closedir($dh);
   }
}
echo '</ul>';
Note: I don't have time to take on any more projects. I'm quite busy. I may be too busy to reply to emails or messages. Thanks for your understanding. :)
User avatar
Dr.CSS
Moderator
Moderator
Posts: 12711
Joined: Thu Mar 09, 2006 5:32 am

Re: Shared tags

Post by Dr.CSS »

U R da Man man...
check it now...
1 last little favor, any way to pull the title from the title tribute/value whatever you call it when you right click an img. > properties > next tab > Summary  title:box
on MS you can give it a title...

oh BTW: did i say THANKS
User avatar
Elijah Lofgren
Power Poster
Power Poster
Posts: 811
Joined: Mon Apr 24, 2006 1:01 am

Re: Shared tags

Post by Elijah Lofgren »

mark wrote: U R da Man man...
check it now...
1 last little favor, any way to pull the title from the title tribute/value whatever you call it when you right click an img. > properties > next tab > Summary  title:box
on MS you can give it a title...

oh BTW: did i say THANKS
you're welcome. Looks very cool!  ;)

About the title attribute, maybe it could be done, but I'm really busy these days so I'm not gonna spend the time looking into it.
Maybe you could find out here: http://us2.php.net/manual/en/function.e ... d-data.php
Note: I don't have time to take on any more projects. I'm quite busy. I may be too busy to reply to emails or messages. Thanks for your understanding. :)
User avatar
Dr.CSS
Moderator
Moderator
Posts: 12711
Joined: Thu Mar 09, 2006 5:32 am

Re: Shared tags

Post by Dr.CSS »

thanks  i'll look into it...
always wonder where to learn php
User avatar
Dr.CSS
Moderator
Moderator
Posts: 12711
Joined: Thu Mar 09, 2006 5:32 am

Re: Shared tags

Post by Dr.CSS »

Check it out i got the titles and i've got it running with the lightbox.js...
and i made the ImageGallery tag on the same page work with the lightbox.js, hacked the IG tag to make it work, only thing is it gets a bigger than thumbnail blank img. box behind the lightbox....

thanx  ;)
User avatar
Dr.CSS
Moderator
Moderator
Posts: 12711
Joined: Thu Mar 09, 2006 5:32 am

Re: Shared tags

Post by Dr.CSS »

Elijah...
have you seen the latest UDT with the new Lightbox v.2...

http://www.multiintech.com/index.php?pa ... orbit_pics
Caspar

Re: Shared tags

Post by Caspar »

EDIT: Ok, finally tested the Album module... no more questions:D :D :D

Elijah Lofgren wrote: Version that outputs thumb_vacation1.jpg format here (like CMSMS uses):  http://wiki.cmsmadesimple.org/index.php ... stpictures
Hi Elijah, hi Mark!

Elijah, is this one easy to fix? I use your udt from the link above, but something messes up the image links. When I click on a thumbnail I get:
The requested URL /uploads/images/testgallery/blumen_09.jpg" was not found on this server.
Is it something with the " at the end of the path? I'm on CMSMS 1.0.2 with page-query-URLs (though I'd like to use the tag with pretty URLs as well...)

Mark, this was the thread I was talking about in my email. Hope, emailing didn't bother you, it was just that I had lost the thread... and your site being really rich! ;)
Last edited by Caspar on Mon Nov 13, 2006 1:56 pm, edited 1 time in total.
User avatar
Dr.CSS
Moderator
Moderator
Posts: 12711
Joined: Thu Mar 09, 2006 5:32 am

Re: Shared tags

Post by Dr.CSS »

Emailing me is no problem, this is the tag for that page, it has a that makes it diff. from the other one I think...
The one problem I had was that the thumbnails generated by Image Manager have the thumb_ on the beginning, thumb_red.jpg, and this needs them on the end, red_thumb.jpg, so I just renamed them...

global $gCms;
$dir = $gCms->config['root_path'] . DIRECTORY_SEPARATOR .'uploads/images/sesame1/';  name of the folder
$url = './uploads/images/sesame1/';
echo '';
// Open a known directory, and proceed to read its contents
if (is_dir($dir)) {
        if ($dh = opendir($dir)) {
                while (($file = readdir($dh)) !== false) {
                    if ('file' == filetype($dir . $file)) {
$thumb0_pos = strpos($file, 'thumb_');
$thumb1_pos = strpos($file, '_thumb');
$pos = strpos($file, '.');
$extension = substr($file, $pos);
if ($thumb0_pos === false && '.jpg' == $extension && $thumb1_pos === false) {
// Note our use of ===.  Simply == would not work as expected
// because the position of 'a' was the 0th (first) character.
if ($pos === false) {
//  echo "The string '$findme' was not found in the string '$mystring'";
} else {
$name = substr($file, 0, $pos);
echo '
'.$name.''."\n";
}
}
                     
                    }
      }
      closedir($dh);
  }
}
echo '';
Post Reply

Return to “CMSMS Core”