Need to pull a custom handle image attribute into a custom pagelist block template.
Permalink 1 user found helpful
Hello C5 Community :)
I was hoping someone could steer me in the right direction here. I've created a custom 'pagelist' block template. Within that I'm trying to retrieve a thumbnail image from a custom attribute with the handle 'recent_news_thumb'.
My page list works great, the pages do have the attribute applied and an image uploaded. That part should be all set. Everything else is great.
At the top of my pagelist block I've tried to add the image helper.
And then later I try to retrieve and display it with the following:
If anyone can point me in the right direction I would greatly appreciate it. Thanks.
I was hoping someone could steer me in the right direction here. I've created a custom 'pagelist' block template. Within that I'm trying to retrieve a thumbnail image from a custom attribute with the handle 'recent_news_thumb'.
My page list works great, the pages do have the attribute applied and an image uploaded. That part should be all set. Everything else is great.
At the top of my pagelist block I've tried to add the image helper.
And then later I try to retrieve and display it with the following:
If anyone can point me in the right direction I would greatly appreciate it. Thanks.
Thank you John!
This is definitely a step in the right direction.
Plugged in as is - it's not pulling my image, but the php is no longer dieing and makes its way through the for loop.
I'll review Lev's work and double check everything. Still appreciate your response!!
Best regards,
Nick
This is definitely a step in the right direction.
Plugged in as is - it's not pulling my image, but the php is no longer dieing and makes its way through the for loop.
I'll review Lev's work and double check everything. Still appreciate your response!!
Best regards,
Nick
Nick,
Sorry that wasn't a "silver bullet" that just did the trick! If you haven't done too much modification to the page_list template, you may want to consider downloading Jordan's re-vamped version from the Github link I posted before. I had trouble using the core block's template when I first tried, but find Jordan's code to be MUCH easier to understand and edit (plus he includes a bunch of example code for how to accomplish various tasks like grabbing attributes, images, etc). Since what I gave you came from his template, it might be easier to cut-and-paste from your current template into his to give that a try.
Let me know how you make out... or if you hit specific stumbling blocks. *I* may not be able to help, but surely *someone* on here can! ;D
- John
Sorry that wasn't a "silver bullet" that just did the trick! If you haven't done too much modification to the page_list template, you may want to consider downloading Jordan's re-vamped version from the Github link I posted before. I had trouble using the core block's template when I first tried, but find Jordan's code to be MUCH easier to understand and edit (plus he includes a bunch of example code for how to accomplish various tasks like grabbing attributes, images, etc). Since what I gave you came from his template, it might be easier to cut-and-paste from your current template into his to give that a try.
Let me know how you make out... or if you hit specific stumbling blocks. *I* may not be able to help, but surely *someone* on here can! ;D
- John
Yeah, now that I've looked more closely, that's a thing of beauty. Works like a charm.
Thank you so much John! +Karma to you (and Jordan Lev!) ;)
Cheers.
The result will soon be up on the homepage (recent news) of:
http://www.keloha.com
JIC someone's interested in viewing an (admittedly) bulky but still resolution adaptive summertime theme for inspiration... Or go on a summer vacation and hang out with wake-boarders and good looking women. *shrugs*
Thank you so much John! +Karma to you (and Jordan Lev!) ;)
Cheers.
The result will soon be up on the homepage (recent news) of:
http://www.keloha.com
JIC someone's interested in viewing an (admittedly) bulky but still resolution adaptive summertime theme for inspiration... Or go on a summer vacation and hang out with wake-boarders and good looking women. *shrugs*
I'd rework your header like this:
Then, inside the loop/foreach part that is processing array of pages the page_list has retrieved, add this:
Replace "64" with max width, "9999" with max height. The "9999" effectively means "no maximum size" for that particular dimension. If you're on Concrete5.4.2 or higher, you can also pass a 4th argument of TRUE to enable cropping.
Then, where you want to output your image, use this:
If this works, it was all Jordan Lev's doing (as I mentioned, all of this was copied directly from his code). If it DOESN'T work, I'm sure it's my fault. LOL!
Hope this helps!
- John