SimplePortal

Customization => Custom Coding => Topic started by: IdanC on January 11, 2010, 04:10:48 PM

Title: what's the php code to add a block?
Post by: IdanC on January 11, 2010, 04:10:48 PM
lets say i what to manually create block id 42. what's the code?

is there something like sp_block(42)?
Title: Re: what's the php code to add a block?
Post by: Nathaniel on January 11, 2010, 10:33:52 PM
There isn't a function which is specifically designed to add a new block, the 'sportal_admin_block_edit' function from the 'Sources/PortalAdminBlocks.php' file handles the editing and adding of blocks via the SimplePortal admin area.

Blocks are stored within the database, using a automatically incrementing index/id, so you can't really specify an id for a particular block.

Manually adding a new block (separate of that function) would involve writing your own code to add the required database entires for a block. Its possible, although is there any particular reason why you want to do it?
Title: Re: what's the php code to add a block?
Post by: IdanC on January 29, 2010, 08:32:43 AM
thanks for the quick reply, sorry for the late follow up -

if i already created the block, but i wish to add it into a page by editing the page's template.

is it possible?
Title: Re: what's the php code to add a block?
Post by: [SiNaN] on January 29, 2010, 11:50:53 AM
You want to display the block on a specific page? You can do that by Admin > SimplePortal > Blocks > [Edit your block].

Enable "Advanced Options" setting in "Display Options" area. Expand "Select Pages" list and selec the pages you want the block to be displayed on.
Title: Re: what's the php code to add a block?
Post by: IdanC on January 29, 2010, 04:26:38 PM
wow, thanks for being able to say such a basic piece of information without the slightest bit of patronization  :nervous-happy:

but id like to have more options than "left right top bottom", so i'd like to manually add specific existing blocks to templates i have.
SimplePortal 2.3.8 © 2008-2024, SimplePortal