Hello all,
I'm trying to use Global Content Blocks to only contain content, to make it easier on my client. I'm then using the User-Defined Tags to store both PHP and HTML, by closing php and re-opening... "?><?".
It's mostly working well, but I'd like to be able include a Global Content Block INSIDE my UDT. This way, my client could update the text, without having all the PHP/HTML in the way, and I can reuse the UDT around the site. When I put {global_content name='test'} in the UDT, it outputs that exactly, instead of the content.
Can anyone point me in the right direction?
Thanks,
Philip Light
Global Content Block inside a User-Defined Tag
-
- Support Guru
- Posts: 8169
- Joined: Tue Oct 19, 2004 6:44 pm
Re: Global Content Block inside a User-Defined Tag
lib/classes/class.globalcontentoperations.php
Follow me on twitter
Please post system information from "Extensions >> System Information" (there is a bbcode option) on all posts asking for assistance.
--------------------
If you can't bother explaining your problem well, you shouldn't expect much in the way of assistance.
Please post system information from "Extensions >> System Information" (there is a bbcode option) on all posts asking for assistance.
--------------------
If you can't bother explaining your problem well, you shouldn't expect much in the way of assistance.
Re: Global Content Block inside a User-Defined Tag
Thanks Calguy,
Not sure I understand though. Am I on the right path trying to call this from the UDT...
echo $this-> LoadHtmlBlobByName('estimate_request_content');
Thanks as always,
Philip
Not sure I understand though. Am I on the right path trying to call this from the UDT...
echo $this-> LoadHtmlBlobByName('estimate_request_content');
Thanks as always,
Philip
-
- Support Guru
- Posts: 8169
- Joined: Tue Oct 19, 2004 6:44 pm
Re: Global Content Block inside a User-Defined Tag
Well it's the right method.... but in a UDT there is no class.... so you'll have to load the globalcontentoperations object from the $gCms object..... take a look in class.global.inc.php.
Follow me on twitter
Please post system information from "Extensions >> System Information" (there is a bbcode option) on all posts asking for assistance.
--------------------
If you can't bother explaining your problem well, you shouldn't expect much in the way of assistance.
Please post system information from "Extensions >> System Information" (there is a bbcode option) on all posts asking for assistance.
--------------------
If you can't bother explaining your problem well, you shouldn't expect much in the way of assistance.
Re: Global Content Block inside a User-Defined Tag
This is a bit bit over my php-head...lol. Something like?...
global $gCms;
$gc = GlobalContentOperations::LoadHtmlBlobByName('estimate_form_content');
echo $gc->content;
global $gCms;
$gc = GlobalContentOperations::LoadHtmlBlobByName('estimate_form_content');
echo $gc->content;
-
- Support Guru
- Posts: 8169
- Joined: Tue Oct 19, 2004 6:44 pm
Re: Global Content Block inside a User-Defined Tag
I think that's close..... but you need to load the contenblock operations method.... and without looking up the syntax (you'll see the exact function names in the class.globa.inc.php and class.globalcontentoperations.inc.php
it'd be something like:
it'd be something like:
Code: Select all
global $gCms
$gcbops =& $gCms->GetContentBlockOperations();
$obj =& $gcbops->LoadHtmlBlobByName($name);
return $obj->content;
Follow me on twitter
Please post system information from "Extensions >> System Information" (there is a bbcode option) on all posts asking for assistance.
--------------------
If you can't bother explaining your problem well, you shouldn't expect much in the way of assistance.
Please post system information from "Extensions >> System Information" (there is a bbcode option) on all posts asking for assistance.
--------------------
If you can't bother explaining your problem well, you shouldn't expect much in the way of assistance.
Re: Global Content Block inside a User-Defined Tag
Beauty! It was...
global $gCms;
$gcbops=&$gCms->GetGlobalContentOperations();
$obj=&$gcbops->LoadHtmlBlobByName("test");
return $obj->content;
...and it worked a charm!
Thanks Calguy!
global $gCms;
$gcbops=&$gCms->GetGlobalContentOperations();
$obj=&$gcbops->LoadHtmlBlobByName("test");
return $obj->content;
...and it worked a charm!
Thanks Calguy!
-
- Support Guru
- Posts: 8169
- Joined: Tue Oct 19, 2004 6:44 pm
Re: Global Content Block inside a User-Defined Tag
Give a man a fish and he eats for a day..... yada yada yada 

Follow me on twitter
Please post system information from "Extensions >> System Information" (there is a bbcode option) on all posts asking for assistance.
--------------------
If you can't bother explaining your problem well, you shouldn't expect much in the way of assistance.
Please post system information from "Extensions >> System Information" (there is a bbcode option) on all posts asking for assistance.
--------------------
If you can't bother explaining your problem well, you shouldn't expect much in the way of assistance.