Deano's "Add PHP blocks to Pagebuilder" mod.

I started working on this in an earlier thread:

http://www.boonex.com/unity/forums/#topic/Add-a-column-to-every-page-.htm

but it's morphed into a different subject so I'm starting over.  I'm trying to figure out how to edit Deano's excellent mod so it'll add more than one PHP block to Pagebuilder, and each one will different properties.

My first, not totally well thought through attempt at figuring it out:

Looking at the work I need to do it seems like it would save a lot of repetitive work if I could use Deano's "Add PHP blocks to Pagebuilder for D7" mod but change it so that instead of adding generic PHP Blocks that I'll then have to edit in two different Admin dialogs, it would add blocks that are already named and Language Keyed as I need them to be. Ideally I'll end up with 3 or 4 new blocks available in Page Builder that are named something like "PHP Content1", "PHP Content2", etc.

I've gone through the mod and tried to figure out how it needs to be changed, but I'm sure I'm wrong about some things and missing others. Deano - would you be willing to look through this and see if it looks like I'm on the right track?

I've changed the SQL query so it looks like this:

INSERT INTO `sys_page_compose` (`Page`, `PageWidth`, `Desc`, `Caption`, `Column`, `Order`, `Func`, `Content`, `DesignBox`, `ColWidth`, `Visible`, `MinWidth`) VALUES ('', '998px', 'Simple PHP Block', '_PHPcontent1 Block', 0, 0, 'Sample', 'PHP', 1, 0, 'non,memb', 0)

And the Language keys that need to be created:

Key Name: _adm_pbuilder_PHPcontent1_Block
String Text: My PHP content headline


Click save and repeat for the next 2 keys.

Key Name: _adm_pbuilder_PHP_content
String Text: PHP-Content

Key Name: _PHPcontent1 Block
String Text: My PHP content headline

And then the edits to inc\classes\BxDolPageViewAdmin.php (I'm only including the code section that I've re-edited from Deano's original edits - I hope that's OK - I only found one obvious edit)

function showPropForm($iBlockID) {
$sNoPropertiesC = _t('_adm_pbuilder_This_block_has_no_properties');
$sProfileFieldsC = _t('_adm_pbuilder_Profile_Fields');
$sHtmlBlockC = _t('_adm_pbuilder_HTML_Block');
$sPHPBlockC = _t('_adm_pbuilder_PHPcontent1_Block');
$sXmlBlockC = _t('_adm_pbuilder_XML_Block');
$sRssBlockC = _t('_adm_pbuilder_RSS_Feed');
$sSpecialBlockC = _t('_adm_pbuilder_Special_Block');
$sHtmlContentC = _t('_adm_pbuilder_HTML_content');
$sPHPContentC = _t('_adm_pbuilder_PHP_content');
$sXmlPathC = _t('_adm_pbuilder_XML_path');

I'm afraid to try it because I'd have no idea how to fix things if I screw up :)

Thanks!

Al

Looking at it again I realize that since the edits to inc\classes\BxDolPageViewAdmin.php are permanent I would be writing over part of the existing install of Deano's mod that I have on my D7 install and that's not what I want to do - I want it to add new blocks in addition to the one I've added already.

I've stepped over the threshold of my own incompetence here and I'm wandering lost in the halls of ignorance - anyone out there have some suggestions?

Thanks!

Quote · 12 Mar 2010

I have no idea why you would need to do this.

When you drag a php block up into the page you have to edit it to set it's content anyway, so at the same time you just edit the lang key.

I guess i am confused as to what you are trying to accomplish with this.

But anyway. All you need is the sql query and one language key for the new box headline. No additional code changes would be needed to get the second php block with a different name.

https://www.deanbassett.com
Quote · 12 Mar 2010

Thanks for your reply Deano.  I'm figuring this stuff out as I go along so I'm not doing a great job of explaining what I'm after.

Here's my thinking: I want to have 3 or 4 PHP blocks on each page of my site, each of which uses "echo file_get_contents" to call the contents from individual HTML pages.  This way I can make site-wide changes to any of those blocks by editing the HTML files.


I installed your mod and it's totally excellent and easy to install - thank you.


My problem now is that to get what I want I need to:
Go in Pagebuilder and drag an "empty" PHP block into position on the page.

Then I have to edit, in the Pagebuilder - block dialog:
the "Caption Lang Key" and the "PHP-Content" (into which I'm placing the echo file_get_contents('rotat1.html'); )
and then I need to move over to the Language Settings and edit the "String text for English language" in the Language Key - Key dialog.

And then I have to go back and do it all over again 3 more times on that page and 3 or 4 times on every other page in the site.

So what I'd like to do it set it up so I can just go into Pagebuilder, select a page and have pre-configured PHP blocks available there that I can drag into place (lets call them "Rotate1", "Rotate2", etc. - each one calling a different HTML page) and all those edits -  the "Caption lang", the "String text" and (ideally) the "PHP-Content" - are already taken care of.
It seems like a "block builder" should be built into Dolphin but I can't find anything like that - am I missing something?

Make sense?  Is it something a modified version of your mod can do?

Quote · 14 Mar 2010

bump!

Quote · 19 Mar 2010

My mod can not do that.

The block cannot be pre populated with code and still remain a block that can be dragged in. The key is 2 fields in the database entry. The one set to sample tells dolphin that it's a sample block( IE. a block type that is always there to be used again) . The one labeled PHP tells dolphin that it is a php block.

When the block is dragged in, the word sample is replaced with PHP and the one labeled PHP becomes the code field. Dolphin does this, not my code.

To preset the code would require that this be done ahead of time which no longer makes it a sample block that can be dragged in a number of times.


Now if your site is not running more than one language you can save some time by not using a language. In cap language you can just enter the title as you want to to read, and skip the adding of a language key. I know that only saves a little time, but my mod cannot do what your looking to do. That would require a more specialized mod.

https://www.deanbassett.com
Quote · 19 Mar 2010

Thanks for getting back about this Dean - I appreciate it.

A shame that your mod won't do this, and I'm surprised and disappointed that a "block builder" isn't built into Dolphin - it seems like a logical addition to the other built-in functions.

I wish I was capable of creating a mod like this myself but it's definitely way beyond my tech abilities.  I and I imagine others would be happy to pay for a mod that added a block-builder to the Dolphin admin - is it something you'd have the time and interest to put together, Dean?  If it would be worth it for you please consider doing it!

Quote · 20 Mar 2010
 
 
Below is the legacy version of the Boonex site, maintained for Dolphin.Pro 7.x support.
The new Dolphin solution is powered by UNA Community Management System.