Go to main content

Textpattern CMS support forum

You are not logged in. Register | Login | Help

#685 2010-05-14 15:46:21

jmuspratt
Member
From: Nashville, TN
Registered: 2004-10-27
Posts: 54
Website

Re: smd_gallery: super-flexible gallery generator

Fantastic, thanks so much! Will try it out and report back…

Offline

#686 2010-05-16 22:06:01

jmuspratt
Member
From: Nashville, TN
Registered: 2004-10-27
Posts: 54
Website

Re: smd_gallery: super-flexible gallery generator

This is working perfectly. Thanks again!

The only thing I can’t figure out is how to highlight the current image category in the list. Clearly we have access to the current category with $variable[‘chosen-cat’], so I thought that during the category_list loop I should be able to compare each value against it:

<txp:category_list break="" type="image" parent='<txp:variable name="theArtist" />' exclude='<txp:variable name="theArtist" />'>
<li<txp:php global $variable; if ($variable['chosen_cat'] == $GLOBALS['pretext']['c']) {echo "class='current'"}></txp:php>><a href="<txp:permlink />/<txp:category />"><txp:category title="1" /></a></li>
</txp:category_list>

But that throws an error about not having a txp:article tag on the line or something. Does the $GLOBALS[‘pretext’][‘c’] not refer to the current value of txp:category when it’s in a category_list loop like this? Any thoughts?

Last edited by jmuspratt (2010-05-16 22:06:42)

Offline

#687 2010-05-17 08:20:55

Bloke
Developer
From: Leeds, UK
Registered: 2006-01-29
Posts: 10,562
Website GitHub

Re: smd_gallery: super-flexible gallery generator

jmuspratt wrote:

This is working perfectly. Thanks again!

No probs.

The only thing I can’t figure out is how to highlight the current image category in the list

How about using TXP tags instead? Since the $variable simply sets a txp:variable of the given name, you should be able to do something like this:

<txp:category_list break="" type="image" parent='<txp:variable name="theArtist" />' exclude='<txp:variable name="theArtist" />'>
<li<txp:if_variable name="chosen_cat" value='<txp:category />'> class="current"</txp:if_variable>><a href="<txp:permlink />/<txp:category />"><txp:category title="1" /></a></li>
</txp:category_list>

The smd plugin menagerie — for when you need one more gribble of power from Textpattern. Bleeding-edge code available on GitHub.

Txp Builders – finely-crafted code, design and Txp

Offline

#688 2010-05-17 20:44:24

jmuspratt
Member
From: Nashville, TN
Registered: 2004-10-27
Posts: 54
Website

Re: smd_gallery: super-flexible gallery generator

Perfect — thank you again!

Offline

#689 2010-05-21 13:09:55

hablablow
Member
From: Paris
Registered: 2004-12-13
Posts: 309
Website

Re: smd_gallery: super-flexible gallery generator

Stef,

This follows your earlier reply here

In an article custom call we get these values

<txp:article_custom>
   <txp:php>
   global $article_info;
   $article_info[upm_img_id(array())] = array(
         'id' => article_id(array()),
         'title' => title(array()),
         'category' => category1(array()),
         'category_t' => category1(array('title' => '1')),
         'section' => section(array()),
      );
</txp:php>
</txp:article_custom>
<txp:smd_gallery form="smd_call" />

Then in the txp:smd_gallery form call:

<txp:php>
   global $article_info;
   $href = permlink(array('id' => $article_info[{id}]['id']));
   echo '<a href="' . $article_info[{id}]['section'] . '/' . $article_info[{id}]['category'] . '/' . $article_info[{id}]['title'] . '">' . $article_info[{id}]['title'] . '</a>';
</txp:php>

Using: ‘title’ => title(array(‘url_title’ => ‘1’)) in the article_custom call fires errors
Using: $article_info[{id}][‘url_title’] in the smd_gallery call simply outputs nothing
Or other combinations doesn’t work…

Thanks !


_
_I plant seeds for future visions. Farmer of your eyes. Subliminal engineer of your minds. eion founder__

Hablablow + Webdesignofficina

Offline

#690 2010-05-21 13:28:54

Bloke
Developer
From: Leeds, UK
Registered: 2006-01-29
Posts: 10,562
Website GitHub

Re: smd_gallery: super-flexible gallery generator

hablablow

I didn’t realise when you wrote in the other thread you were doing this. You don’t need to access the variable directly then, because there’s a TXP tag <txp:article_url_title> to help out. But before you can use it in your form, you’ll need to add the info to the array:

<txp:article_custom>
   <txp:php>
   global $article_info
   $article_info[upm_img_id(array())] = array(
         'id' => article_id(array()),
         'title' => title(array()),
         'url_title' => article_url_title(array()),
         'category' => category1(array()),
         'category_t' => category1(array('title' => '1')),
         'section' => section(array()),
      );
</txp:php>
</txp:article_custom>

You can then access $article_info[{id}]['url_title'].


The smd plugin menagerie — for when you need one more gribble of power from Textpattern. Bleeding-edge code available on GitHub.

Txp Builders – finely-crafted code, design and Txp

Offline

#691 2010-05-21 13:33:06

hablablow
Member
From: Paris
Registered: 2004-12-13
Posts: 309
Website

Re: smd_gallery: super-flexible gallery generator

Yeepee yay !

Thank you sooooooooooo much Stef !

:)


_
_I plant seeds for future visions. Farmer of your eyes. Subliminal engineer of your minds. eion founder__

Hablablow + Webdesignofficina

Offline

#692 2010-05-21 14:24:20

maniqui
Member
From: Buenos Aires, Argentina
Registered: 2004-10-10
Posts: 3,070
Website

Re: smd_gallery: super-flexible gallery generator

Hi hablablow,

If you have a few extra minutes, please, do you think you could explain what are you doing with that code? (I’ve read it and re-readit a few times, but haven’t grasped yet what is going on behind the curtains). I’m curious about what it does and how it works.
If there are no exta minutes, don’t worry then.

Thanks!


La música ideas portará y siempre continuará

TXP Builders – finely-crafted code, design and txp

Offline

#693 2010-05-21 14:57:33

hablablow
Member
From: Paris
Registered: 2004-12-13
Posts: 309
Website

Re: smd_gallery: super-flexible gallery generator

Si Julian es un poco complicado pero bueno…

What I do is list article images within a defined section and then paginate them with the use of Stef’s plugin.

I filter my article list the way I want to with the use of article_custom then I pull the article image with the use of the upm_image plugin.

Stef’s plugin allows me to paginate my resulting list.

Easy.

Except that we need to build also an array based on article ID to store the article image order.

That’s why Stef suggested this:

<txp:article_custom>
   <txp:php>
   global $article_info;
   $article_info[upm_img_id(array())] = array(
         'id' => article_id(array()),
         'title' => title(array()),
         'category' => category1(array()),
         'category_t' => category1(array('title' => '1')),
         'section' => section(array()),
      );
</txp:php>
</txp:article_custom>

<txp:smd_gallery form=“smd_call” />

Then in the txp:smd_gallery form call, for example:

<img src=”#” alt=”<txp:php> global $article_info; $href = permlink(array(‘id’ => $article_info[{id}][‘id’])); echo $article_info[{id}][‘title’];</txp:php>” />

So this two step process would output a list of paginated article images based upon the upm_image plugin.

Ya Julian… No se si te parece mas claro asi… Ojala ayudo un poco.

Chau !


_
_I plant seeds for future visions. Farmer of your eyes. Subliminal engineer of your minds. eion founder__

Hablablow + Webdesignofficina

Offline

#694 2010-05-21 15:43:04

maniqui
Member
From: Buenos Aires, Argentina
Registered: 2004-10-10
Posts: 3,070
Website

Re: smd_gallery: super-flexible gallery generator

Thanks, Guillaume.
It helped, although I must confess I still don’t get it very well, but don’t worry about that.

I wonder if it couldn’t be done in just one round and by using just plain TXP & smd_ plugin tags, discarding upm_image.
Something like:

<txp:article_custom><!-- fetch the articles -->
  <txp:smd_gallery id="?article_image"><!-- pull the article images field -->
  <!-- ... do stuff here... -->
  </txp:smd_gallery>
</txp:article_custom>

Except that we need to build also an array based on article ID to store the article image order.

This is one thing I didn’t get. Do you want the images sorted in the order that articles were pulled? Which is the sorting criteria for articles and/or article images then?

I’m just thinging loud, don’t feel like you have to give an answer.

BTW: your Spanish is pretty good.


La música ideas portará y siempre continuará

TXP Builders – finely-crafted code, design and txp

Offline

#695 2010-05-21 15:45:24

maniqui
Member
From: Buenos Aires, Argentina
Registered: 2004-10-10
Posts: 3,070
Website

Re: smd_gallery: super-flexible gallery generator

Well, I’ll look into your original request to have a better understanding of your goal. :)


La música ideas portará y siempre continuará

TXP Builders – finely-crafted code, design and txp

Offline

#696 2010-05-21 15:52:50

hablablow
Member
From: Paris
Registered: 2004-12-13
Posts: 309
Website

Re: smd_gallery: super-flexible gallery generator

I wonder if it couldn’t be done in just one round and by using just plain TXP & smd_ plugin tags

Probably, but I needed it to fit my special case…

Which is the sorting criteria for articles and/or article images then

The one you need: use all the power of article_custom to filter your lists the way you want to.

BTW: … Si gracias, y me encantan los Havanas blancos ;)

Last edited by hablablow (2010-05-21 15:53:08)


_
_I plant seeds for future visions. Farmer of your eyes. Subliminal engineer of your minds. eion founder__

Hablablow + Webdesignofficina

Offline

Board footer

Powered by FluxBB