HTML in new PHP block

I have created a PHP block using Deanos tools to insert a block showing featured photos.

I want to add a Header above  the photos but cannot seem to make an "echo" work.

any ideas

www.my-selfiee.com

Nigel
Quote · 15 Mar 2014

You can being by showing us what code your using in a php block. "Cannot seem to make an "echo" work." does not tell us anything.

Php block code.


echo "This is a test. Really quite simple.";


Thats all there is to a echo.

https://www.deanbassett.com
Quote · 15 Mar 2014

 Deano,The block has this code in it to show the featured photos:

The code I was using to add the line above the photos was

Echo "<html>";
 Echo "Impress us with your #Selfie and appear in the Featured Gallery of<b>Me Myself & I</b>";

Code below works without the above

echo $sOutput;
require_once(BX_DIRECTORY_PATH_MODULES . 'boonex/photos/classes/BxPhotosSearch.php');

$this->oSearch = new BxPhotosSearch();

$this->oSearch->aCurrent['restriction']['featured'] = array(

            'field' => 'Featured',

            'value' => '',

            'operator' => '=',

            'paramName' => 'featured'

        );

    $this->oSearch->aConstants['linksTempl']['featured'] = 'browse/featured';

        $aCustom = array(

        'per_page' => '8',

        'menu_bottom_type' => 'featured',

'wrapper_class' => 'result_block'

    );

        $aCode = $this->oSearch->getBrowseBlock(array('featured' => 1, 'allow_view' => $this->aVisible), $aCustom);

    if ($this->oSearch->aCurrent['paginate']['totalNum'] > 0)

return array($aCode['code'], $aCode['menu_top'], $aCode['menu_bottom'], '');

Nigel
Quote · 16 Mar 2014

Ah.

Look at the last line. You will see the php code your using is returning code to dolphin. Not echoing it. So your echos will not work as that is not how the rest of the block is working.

So what you need to do is prefix your code into the $aCode['code'] part of the array thats being returned.

And what on earth is this line near the beginning.

echo $sOutput;

It serves no purpous and should not even be there.


So in other words. Just before this line.

return array($aCode['code'], $aCode['menu_top'], $aCode['menu_bottom'], '');

You add this.

$aCode['code'] = "<div>Impress us with your #Selfie and appear in the Featured Gallery of<b>Me Myself & I</b></div>" . $aCode['code'];

That Echo "<html>"; you had there i did not include. It is not valid where you were trying to use it.


https://www.deanbassett.com
Quote · 16 Mar 2014

So complete modified code.


require_once(BX_DIRECTORY_PATH_MODULES . 'boonex/photos/classes/BxPhotosSearch.php');

$this->oSearch = new BxPhotosSearch();

$this->oSearch->aCurrent['restriction']['featured'] = array(

            'field' => 'Featured',

            'value' => '',

            'operator' => '=',

            'paramName' => 'featured'

        );

    $this->oSearch->aConstants['linksTempl']['featured'] = 'browse/featured';

        $aCustom = array(

        'per_page' => '8',

        'menu_bottom_type' => 'featured',

'wrapper_class' => 'result_block'

    );

        $aCode = $this->oSearch->getBrowseBlock(array('featured' => 1, 'allow_view' => $this->aVisible), $aCustom);

    if ($this->oSearch->aCurrent['paginate']['totalNum'] > 0)

$aCode['code'] = "<div>Impress us with your #Selfie and appear in the Featured Gallery of<b>Me Myself & I</b><div>" . $aCode['code'];

return array($aCode['code'], $aCode['menu_top'], $aCode['menu_bottom'], '');

https://www.deanbassett.com
Quote · 16 Mar 2014

Thanks Deano,

all working Ok.

Your help is greatly appreciatedLaughing

Nigel
Quote · 16 Mar 2014
 
 
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.