Custom PHP

Hi All,

I have a Dolphin 7 site setup, but I just want to have a custom page (that uses the site's template) where I can run some PHP code, access the main database, etc, which still has the site's template (header and footer) surrounding it.

Do I have to actually create my own whole separate module to do this?

Surely that's just overkill.  There must be an easier way...


Please help if you can, or direct me to documentation that explains it.

Thanks!

Quote · 15 Feb 2010

Member Deano did a great mod for this.  http://www.boonex.com/unity/forums/?action=goto&search=1#topic/Add-PHP-blocks-to-Pagebuilder-for-D7.htm

To do what you want, after you apply this mod, make new page with a single column, and put your php block in there.

Good luck!

Rob

Quote · 15 Feb 2010

Thanks Caltrade.

I may try the Block Magic module first though.  It seems a bit easier...

Quote · 15 Feb 2010

Actually, for anyone else interested, an example of how to do this comes with Dolphin 7.

Just visit this file and read through the example:

/inc/classes/BxDolPageView.php

Quote · 15 Feb 2010

Thanks for the information, Cpcan. Here's an excerpt to save anyone some time:


/**
* This class used for generation content of columned pages with blocks.
*
* Example of using.
* To create your own columned php page using this class you should follow these instructions:
*
* 1. Create in the root of your site file with chosen name. For example we will use example.php with following content:
*
* <?php
*
* require_once( 'inc/header.inc.php' );
* require_once( BX_DIRECTORY_PATH_INC . 'utils.inc.php' );
* bx_import('BxDolPageView');
*
* class BxExamplePageView extends BxDolPageView {
* function BxExamplePageView() {
* parent::BxDolPageView('example'); // Attention! Here should be name which you will insert into sys_page_compose_pages in next step.
* }
*
* // Here is functions that generate blocks on page. They are contain only contents of blocks.
* // You do not have to worry about it's title, design, etc. PageView class will make it itself.
*
* // This function creates first block
* function getBlockCode_BlockOne() {
* return 'Hello world!';
* }
*
* // This function creates another block with dynamic menu tabs
* function getBlockCode_BlockTwo() {
* return array(
* 'I am Block Two. I have top menu!',
* array(
* _t('_View') => array(
* 'href' => $_SERVER['PHP_SELF'] . '?view=true',
* 'dynamic' => true,
* 'active' => !$this->isEditable,
* ),
* _t('_Edit') => array(
* 'href' => $_SERVER['PHP_SELF'] . '?edit=true',
* 'dynamicPopup' => true,
* 'active' => $this->isEditable,
* )
* )
* );
* }
* }
*
* $_page['name_index'] = 0; // choose your own index of template or leave if in doubt
* $_page['header'] = 'Example page';
* $_ni = $_page['name_index'];
*
* $oEPV = new BxExamplePageView();
* $_page_cont[$_ni]['page_main_code'] = $oEPV->getCode();
*
* PageCode();
*
* ?>
*
* 2. Insert into your sys_page_compose_pages table one line.
* Name - Unique identification name of the page. Used for association page with its blocks.
* We recommend use only latin symbols and digits. (In our example use "example")
* Title - Title of your page, it is shown in the Page Builder. ("Example page")
* Order - Just the order in list of pages in the Page Builder.
*
* 3. Insert into sys_page_compose lines for each block.
* ID - ID of the block. System field. Leave it by default (0). Will be passed to the function as first argument.
* Page - ID name of page which you inserted to sys_page_compose_pages ("example").
* PageWidth - System field. Leave it by default ("960px"). Customized later.
* Desc - Few words about this block. Description.
* Caption - Title of this block. ("Block One", "Block Two")
* Column - System field. Leave it by default (0). Customized later.
* Order - System field. Leave it by default (0). Customized later.
* Func - Name of function in your class (without prefix) which will be called to generate the block. ("BlockOne", "BlockTwo")
* Content - Optional argument. Rarely used. Passed as the second argument to the function.
* DesignBox - Number of Design Box (container). Leave it by default if in doubt (1).
* ColWidth - System field. Leave it by default (0). Customized later.
* Visible - System field. Leave it by default (0). Customized later.
* MinWidth - Minimum recommended width of the block.
*
* 4. Now go to the Page Builder, select your page in the list of pages and customize it (width, columns and blocks order).
Then customize every block (caption, visibility, etc.).
*
* 5. Open http://yoursite.com/example.php in your browser and you will see your new customized columned page.
*
*/

BoonEx Certified Host: Zarconia.net - Fully Supported Shared and Dedicated for Dolphin
Quote · 15 Feb 2010

Thanks Caltrade.

I may try the Block Magic module first though.  It seems a bit easier...

What is the Block Magic module?

Quote · 15 Feb 2010

Thanks Caltrade.

I may try the Block Magic module first though.  It seems a bit easier...

What is the Block Magic module?

It's an extension on Expertzzz that does the same thing, albeit with a scripted interface. It's available for free from here (while the web site remains): http://www.expertzzz.com/Downloadz/view/6929

BoonEx Certified Host: Zarconia.net - Fully Supported Shared and Dedicated for Dolphin
Quote · 16 Feb 2010

HELLO U ALL;   JUST RUN THE FOLLOWING CODE. PROBLEM SOLVED. YOU WILL ACTIVATE THE PHP;

 

http://www.example.com/administration/pageBuilder.php?action_sys=addCodeBlock
Quote · 29 Dec 2018

TO REMOVE RUN THIS;

 

http://www.example.com/administration/pageBuilder.php?action_sys=removeCodeBlock
Quote · 29 Dec 2018

also when putting php code in the box, remember not to use php tags [it wont work], use code without these open,close tags , 

<?php  , ?>

Quote · 1 Jan 2019
 
 
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.