• twitter image
  • facebook image
  • youtube image
  • linkedin image
Language: CMS Made Simple Czech CMS Made Simple France CMS Made Simple Spain CMS Made Simple Hungary CMS Made Simple Russia CMS Made Simple Netherlands

All times are UTC




Post new topic Reply to topic  [ 11 posts ] 
Author Message
 Post subject: Re: Content block with Gallery picker
PostPosted: Thu May 10, 2012 2:12 pm 
Offline
Dev Team Member
Dev Team Member
User avatar

Joined: Fri Nov 30, 2007 9:15 am
Posts: 350
Hi kernity,

Thanks for sharing this!
I was working on accomplishing the same but didn't get it to work so i searched the forum and luckily found your post! (not a single other posts on this, kind of surprises me...)

What version of the cms and Gallery module are you using?
I'm using (all the very latest):
cmsms 1.10.3
ECB 1.3
CGExtensions 1.28.2
Gallery 1.5.3

I'm asking because i get the error below when i test your UDT solution:
\$1:
Fatal error: Call to undefined method Gallery::_GetGalleries() in /home/cremedel/public_html/lib/classes/class.usertagoperations.inc.php(260) : eval()'d code on line 2


How did i try to accomplish it?
In gallery, create a template "selectbox" containing the following:
\$1:
{foreach from=$images item=image name=img}
{if $image->isdir}{$image->titlename}={$image->titlename}{if $smarty.foreach.img.last}{else},{/if}{/if}
{/foreach}

This will create the required output as specified in the ECB help file:
(test the output by putting {Gallery action='gallerytree' template='selectbox'} in the content of a page).
\$1:
galleryname=http://www.domain.com/gallerysomething/url/,galleryname2=http://www.domain.com/gallerysomething2/url/

The code to enter in the page template:
\$1:
{content_module module="ECB" field="dropdown_from_module" block="test2" label="Gallery" mod="cms_module module='Gallery' action='gallerytree' template='selectbox'"}

This generates the error below:
\$1:
string(122) "Smarty error: [in temporary template line 1]: syntax error: missing attribute value (Smarty_Compiler.class.php, line 1593)"

So i'm stuck with 2 perfectly workable solutions that both produce errors :'(

Greetings,
Manuel

_________________
Do you like your open source cms? Buy from the CMSMS partners || Donate
(or at least share some knowledge :D >> See some of my stuff )


Top
  Profile  
 
Share On:
Share on Facebook Share on Twitter Share on Google+
 Post subject: Re: Content block with Gallery picker
PostPosted: Sun May 20, 2012 7:05 pm 
Offline
Support Guru
Support Guru
User avatar

Joined: Wed Sep 05, 2007 8:03 pm
Posts: 4014
Location: The Netherlands
Hi Manuel,

Since CMSms 1.10 and Gallery 1.5, you should be able to call it with:
\$1:
$galleries = Gallery_utils::GetGalleries();


Also might want to check the
\$1:
Gallery_utils::GalleryDropdown();

_________________


Top
  Profile  
 
Share On:
Share on Facebook Share on Twitter Share on Google+
 Post subject: Re: Content block with Gallery picker
PostPosted: Mon May 21, 2012 4:00 pm 
Offline
Power Poster
Power Poster
User avatar

Joined: Tue Dec 23, 2008 8:39 pm
Posts: 1369
What I often do is make a gallery folder called 'content' .. Inside that, I create directories with the same name as the page alias. If the directory exists for that page, I call Gallery.


Top
  Profile  
 
Share On:
Share on Facebook Share on Twitter Share on Google+
 Post subject: Re: Content block with Gallery picker
PostPosted: Fri Jun 15, 2012 3:28 am 
Offline
New Member
New Member

Joined: Tue Dec 06, 2011 10:26 pm
Posts: 9
Just implemented this using ECB and a slightly modified UDT. Thanks to those who posted suggestions on this thread!

template code
\$1:
{content_module module="ECB" field="dropdown_from_module" block="gallery" label="Gallery" mod="get_gallery_list" assign="gallery_dir"}
{if isset($gallery_dir) && $gallery_dir ne ""}{Gallery dir=$gallery_dir}{/if}


get_gallery_list UDT code
\$1:
$galleries = Gallery_utils::GetGalleries();
$valuepairs = array();
foreach ($galleries as $gallery) {
  $gallery_dir = $gallery['filepath'].rtrim($gallery['filename'], '/');
  $valuepairs[] = $gallery_dir.'='.$gallery_dir;
}
echo implode(",",$valuepairs);


Top
  Profile  
 
Share On:
Share on Facebook Share on Twitter Share on Google+
 Post subject: Re: Content block with Gallery picker
PostPosted: Fri Jun 15, 2012 3:09 pm 
Offline
New Member
New Member

Joined: Fri Jun 15, 2012 3:01 pm
Posts: 4
Hi tbaalham,

I tried to use your code, but i get the following error: Fatal error: Class 'Gallery_utils' not found in C:\****\wwwroot\lib\classes\class.usertagoperations.inc.php(260) : eval()'d code on line 1

It seems almost like the same error as Manuel did get.

What am I doing wrong?

I use the following modules and CMS:
ECB 1.3
CGExtensions 1.29.1
Gallery 1.5.3
CMS 1.10.3

Thnx!


Top
  Profile  
 
Share On:
Share on Facebook Share on Twitter Share on Google+
 Post subject: Re: Content block with Gallery picker
PostPosted: Fri Sep 14, 2012 2:07 am 
Offline
Forum Members
Forum Members

Joined: Thu Jun 01, 2006 8:03 pm
Posts: 62
Hi there, I tried your solution with the very last versions of all modules and core:

CMSMS 1.11.1
ECB 1.3
Gallery 1.6

and every tries broke my back-end pages editing (everything go blank).

So I put the UDT code in a file named function.gls.php in my plugins folder and call it inside ECB module, and tadam!

Complete solution, waiting ECB to work correctly with UDT:

function.gls.php (plugins folder):
\$1:
<?php
function smarty_function_gls()
{
$galleries = Gallery_utils::GetGalleries();
$valuepairs = array();
foreach ($galleries as $gallery) {
  $gallery_dir = $gallery['filepath'].rtrim($gallery['filename'], '/');
  $valuepairs[] = $gallery_dir.'='.$gallery_dir;
}
echo implode(",",$valuepairs);
}
?>


template:
\$1:
{content_module module="ECB" field="dropdown_from_module" block="test2" label="Gallery" mod="gls" assign="gallery_dir" }
{if isset($gallery_dir) && $gallery_dir ne ""}{Gallery dir=$gallery_dir}
{/if}


Hope this will help (and thanks to the cmsms community, this so large brain)..


Top
  Profile  
 
Share On:
Share on Facebook Share on Twitter Share on Google+
 Post subject: Re: Content block with Gallery picker
PostPosted: Thu Jan 10, 2013 3:16 pm 
Offline
Dev Team Member
Dev Team Member
User avatar

Joined: Fri Nov 30, 2007 9:15 am
Posts: 350
Dear Wishbone,

As of version 1.4, ECB no longer supports the dropdown_from_module
I'm glad you replied too as i'm now setting up the galleries like you described earlier.
\$1:
What I often do is make a gallery folder called 'content' .. Inside that, I create directories with the same name as the page alias. If the directory exists for that page, I call Gallery.

I was just wondering if this is more or less what you where doing?
\$1:
{Gallery dir="designers/$page_alias" assign='galleryvar'}{if $galleryvar|strstr:"exist"}no gallery{else}{$galleryvar}{/if}

Greetings,
Manuel

_________________
Do you like your open source cms? Buy from the CMSMS partners || Donate
(or at least share some knowledge :D >> See some of my stuff )


Top
  Profile  
 
Share On:
Share on Facebook Share on Twitter Share on Google+
 Post subject: Re: Content block with Gallery picker
PostPosted: Fri Jan 11, 2013 5:31 pm 
Offline
Power Poster
Power Poster
User avatar

Joined: Tue Dec 23, 2008 8:39 pm
Posts: 1369
Something like that.. To keep it simple and less business logic in Smarty, I would call a UDT to process everything I plan to do on that page. For the gallery I would call a file_exists on the gallery. Then I would return a variable ($data for example), and in the template, I would call:

{if isset($data.gallery){Gallery ...}{/if}

..among all my other logic checks. This keeps the template very simple, and the logic in PHP which is easier to read.


Top
  Profile  
 
Share On:
Share on Facebook Share on Twitter Share on Google+
 Post subject: Re: Content block with Gallery picker
PostPosted: Fri Jan 11, 2013 7:42 pm 
Offline
Dev Team Member
Dev Team Member
User avatar

Joined: Fri Nov 30, 2007 9:15 am
Posts: 350
Dear Wishbone,

thx for the update :)

Greetings,
Manuel

_________________
Do you like your open source cms? Buy from the CMSMS partners || Donate
(or at least share some knowledge :D >> See some of my stuff )


Top
  Profile  
 
Share On:
Share on Facebook Share on Twitter Share on Google+
 Post subject: Re: Content block with Gallery picker
PostPosted: Wed Aug 07, 2013 6:11 am 
Offline
Forum Members
Forum Members

Joined: Mon Nov 01, 2010 8:56 am
Posts: 172
Location: New Zealand
Here is the code I used for generating a gallery dropdown in case it helps someone...

UDT "get_gallery_list" - in my case I wanted to exclude the main parent gallery from the dropdown, hence the if ($gallery['filename'] != "")
\$1:
$galleries = Gallery_utils::GetGalleries();
$valuepairs = array();
foreach ($galleries as $gallery) {
   if ($gallery['filename'] != ""){
      $gallery_dir = $gallery['filepath'].rtrim($gallery['filename'], '/');
      $valuepairs[$gallery_dir] = $gallery_dir;
   }
}
return $valuepairs;


In the template
\$1:
{content_module module="ECB" field="dropdown_from_udt" block="the_gallery" label="Gallery" udt="get_gallery_list" first_value="(none)" assign="the_gallery"}
{if !empty($the_gallery)}
{Gallery dir=$the_gallery}
{/if}


Top
  Profile  
 
Share On:
Share on Facebook Share on Twitter Share on Google+
 Post subject: Re: Content block with Gallery picker
PostPosted: Fri Aug 16, 2013 10:26 pm 
Offline
Forum Members
Forum Members
User avatar

Joined: Sun Sep 07, 2008 10:47 am
Posts: 184
Anyone willing to send me some screenshots (or screencast) of what you're achieving with this feature? I'd love to use it for the purpose of CMS Made Simple™ Marketing. This tip may be mentioned in our next newsletter or be tweeted about by @cmsms.

Would you be so kind to send it to: anne@cmsmadesimple.org

Thanks in advance!

Anne

_________________
"If you think it's expensive to hire a professional to do the job, wait until you hire an amateur..." (Red Adair)


Top
  Profile  
 
Share On:
Share on Facebook Share on Twitter Share on Google+
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 11 posts ] 

All times are UTC


Who is online

Users browsing this forum: No registered users


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to:  
cron
A2 Hosting