How do I access the PageBlock content_id

Have a question or a suggestion about a 3rd party addon module or plugin?
Let us know here.
Post Reply
tmoynih1
New Member
New Member
Posts: 3
Joined: Wed Jan 31, 2007 1:59 pm

How do I access the PageBlock content_id

Post 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
cyberman

Re: How do I access the PageBlock content_id

Post by cyberman »

Have you tried tag {get_template_vars}?

This one shows you every available smarty variable.
tmoynih1
New Member
New Member
Posts: 3
Joined: Wed Jan 31, 2007 1:59 pm

Re: How do I access the PageBlock content_id

Post 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
User avatar
Elijah Lofgren
Power Poster
Power Poster
Posts: 811
Joined: Mon Apr 24, 2006 1:01 am

Re: How do I access the PageBlock content_id

Post 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. :)
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
Elijah Lofgren
Power Poster
Power Poster
Posts: 811
Joined: Mon Apr 24, 2006 1:01 am

Re: How do I access the PageBlock content_id

Post 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
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
Elijah Lofgren
Power Poster
Power Poster
Posts: 811
Joined: Mon Apr 24, 2006 1:01 am

Re: How do I access the PageBlock content_id

Post 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
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. :)
tmoynih1
New Member
New Member
Posts: 3
Joined: Wed Jan 31, 2007 1:59 pm

Re: How do I access the PageBlock content_id

Post 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
User avatar
Lucaz
Forum Members
Forum Members
Posts: 66
Joined: Fri Dec 01, 2006 9:56 pm

Re: How do I access the PageBlock content_id

Post 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.
User avatar
Elijah Lofgren
Power Poster
Power Poster
Posts: 811
Joined: Mon Apr 24, 2006 1:01 am

Re: How do I access the PageBlock content_id

Post 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
Attachments

[The extension txt has been deactivated and can no longer be displayed.]

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
Lucaz
Forum Members
Forum Members
Posts: 66
Joined: Fri Dec 01, 2006 9:56 pm

Solved [How do I access the PageBlock content_id]

Post 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
Last edited by Lucaz on Thu Oct 23, 2008 8:01 am, edited 1 time in total.
Post Reply

Return to “Modules/Add-Ons”