Page 1 of 1

How do I access the PageBlock content_id

Posted: Thu Mar 08, 2007 9:30 pm
by tmoynih1
Hi,

I want to use the content_id of a pageblock as a unique ID to create a variable that I can use within that pageblock multiple times. This variable will be passed to custom tags to generate different screen data. You can get the content_id of the main page easy enough, but I don't see how to access a pageblocks content_id.

Thanks in advance for any help.

Terry

Re: How do I access the PageBlock content_id

Posted: Fri Mar 09, 2007 5:15 am
by cyberman
Have you tried tag {get_template_vars}?

This one shows you every available smarty variable.

Re: How do I access the PageBlock content_id

Posted: Fri Mar 09, 2007 12:47 pm
by tmoynih1
Hi,

That gives you the content_id of the main CMSMS page, but it appears that the PageBlock module pulls content_ids for it's blocks from the same table as the CMSMS does, probably so it doesn't ever get confused. So, the content_ids of PageBlocks is not displayed with the "get_template_vars" tag.

Terry

Re: How do I access the PageBlock content_id

Posted: Mon Mar 12, 2007 4:46 pm
by Elijah Lofgren
tmoynih1 wrote: Hi,

I want to use the content_id of a pageblock as a unique ID to create a variable that I can use within that pageblock multiple times. This variable will be passed to custom tags to generate different screen data. You can get the content_id of the main page easy enough, but I don't see how to access a pageblocks content_id.

Thanks in advance for any help.

Terry
I'm going to try to add this feature (as soon as I move over to our other computer).
It shouldn't be hard, and it should make PageBlocks much more useful. :)

Re: How do I access the PageBlock content_id

Posted: Tue Mar 13, 2007 4:19 am
by Elijah Lofgren
Elijah Lofgren wrote:
tmoynih1 wrote: Hi,

I want to use the content_id of a pageblock as a unique ID to create a variable that I can use within that pageblock multiple times. This variable will be passed to custom tags to generate different screen data. You can get the content_id of the main page easy enough, but I don't see how to access a pageblocks content_id.

Thanks in advance for any help.

Terry
I'm going to try to add this feature (as soon as I move over to our other computer).
It shouldn't be hard, and it should make PageBlocks much more useful. :)
Well, I got quite distracted today with other things. I hope to maybe get this done tomorrow. I need to head to bed now.

Good night,

Elijah

Re: How do I access the PageBlock content_id

Posted: Tue Mar 13, 2007 2:39 pm
by Elijah Lofgren
tmoynih1 wrote: Hi,

I want to use the content_id of a pageblock as a unique ID to create a variable that I can use within that pageblock multiple times. This variable will be passed to custom tags to generate different screen data. You can get the content_id of the main page easy enough, but I don't see how to access a pageblocks content_id.

Thanks in advance for any help.

Terry
Done: http://viewsvn.cmsmadesimple.org/viewsv ... s&view=rev :)

You can download this file: http://viewsvn.cmsmadesimple.org/viewsv ... iew=markup
and replace your current modules/PageBlocks/action.default.php file with it.

Then you can call PageBlocks like this:

Code: Select all

{cms_module module='pageblocks' page_id='15'}
Enjoy,

Elijah

Hmmm... I just read your post again and I don't think this is what you were wanting. LOL. At least it's a feature others will find useful.  :)

Well, It shouldn't be hard to make the page blocks id into a template var.... It wasn't. :)
http://viewsvn.cmsmadesimple.org/viewsv ... s&view=rev

You can either download the changed file here: http://viewsvn.cmsmadesimple.org/viewsv ... iew=markup
and replace your current modules/PageBlocks/classes/class.Text.php with it.

Or you can just open modules/PageBlocks/classes/class.Text.php
Find:

Code: Select all

   $module->smarty->assign('title', $this->mName);
And add this line after it:

Code: Select all

   $module->smarty->assign('pageblock_id', $this->Id());
Now in the template you can get the pageblock content id like this:

Code: Select all

{$pageblock_id}
Have a great day,

Elijah

Re: How do I access the PageBlock content_id

Posted: Fri Mar 16, 2007 7:32 pm
by tmoynih1
Hi Elijah,

Thanks, the last part is what I was looking for. I didn't want to reinvent the wheel, and I new the you were pulling the id out of the content_id table, but couldn't easily find how to access and use it. This is a case of being able to input a piece of information once in a page block and then use it in different ways in the block. i.e. as a link, as text, etc. and formatted differently.

Thanks again.

I appreciate your time and effort.

Regards,
Terry

Re: How do I access the PageBlock content_id

Posted: Sun Oct 05, 2008 5:54 pm
by Lucaz
It does not seem to work for me.

I got a Pageblock where I show a list off drivers in my team:

http://staging.culas.nl/degensimracingt ... s/2008wtcc

Now I want to have a single page for the driver itself using the same content on
http://staging.culas.nl/degensimracingt ... s/2008wtcc but filter only one driver.

So only show content of ID 51 on:
http://staging.culas.nl/degensimracingt ... -loeffler/

In the content field
of http://staging.culas.nl/degensimracingt ... -loeffler/
I've placed this code: {cms_module module='pageblocks' page_id='53'}

With doesn't seem to be working for me.

Re: How do I access the PageBlock content_id

Posted: Wed Oct 22, 2008 11:02 pm
by Elijah Lofgren
culas wrote: It does not seem to work for me.

I got a Pageblock where I show a list off drivers in my team:

http://staging.culas.nl/degensimracingt ... s/2008wtcc

Now I want to have a single page for the driver itself using the same content on
http://staging.culas.nl/degensimracingt ... s/2008wtcc but filter only one driver.

So only show content of ID 51 on:
http://staging.culas.nl/degensimracingt ... -loeffler/

In the content field
of http://staging.culas.nl/degensimracingt ... -loeffler/
I've placed this code: {cms_module module='pageblocks' page_id='53'}

With doesn't seem to be working for me.
Showing a specific block id is not currently possible (the page_id parameter parameter shows the blocks of a specific page, not a specific block id)

I don't have much time, but it wasn't too hard to quickly add a show_block_id parameter.

Here's a patch to make it so you can display a single block id wherever you want:
http://www.elijahlofgren.com/uploads/cm ... meter.diff

Here's patch against the released version of the released pageblocks: http://www.elijahlofgren.com/uploads/cm ... eter.patch

You can ignore the above patches, and just do this in order to try out the show_block_id parameter:
1. Download the attached action.default.php.txt file which includes the above changes.
2. Rename it to action.default.php
3. Overwrite your current modules/PageBlocks/action.default.php with it.
4. In your page replace this code:

Code: Select all

{cms_module module='pageblocks' page_id='53'}
with this code:

Code: Select all

{cms_module module='pageblocks' show_block_id='53'}
(note the new show_block_id parameter instead of page_id)

I hope this helps,

Elijah Lofgren

Solved [How do I access the PageBlock content_id]

Posted: Thu Oct 23, 2008 7:56 am
by Lucaz
Yes it works!
This is great, now we can really work with global content. Just as {cms_module module='pageblocks' show_block_id='53'}
in a the content area and of you go:

http://simracingteam.degen.be/the-drive ... s-loeffler

Now we can make one content block, and use it on more than one page.

Great thanks mate