SimplePortal

Support => English Support => Topic started by: hebron on August 05, 2014, 10:41:19 AM

Title: Show page in block?
Post by: hebron on August 05, 2014, 10:41:19 AM
Is there any way I can show a SimplePortal page inside a block? I have an about page that I would like to show as a block for guest users. Can I include the page text in the block somehow? So that I don't have to update two places?
Title: Re: Show page in block?
Post by: Chen Zhen on August 06, 2014, 04:02:14 PM
hebron,

You can use this as your Custom PHP block code:
Code: [Select]
$page_ID = 'mysample';

global $smcFunc;
$page = array('', '');

$request = $smcFunc['db_query']('', '
SELECT body, type
FROM {db_prefix}sp_pages
WHERE namespace = {string:page_name}
LIMIT {int:limit}',
array(
'page_name' => $page_ID,
'limit' => 1,
)
);
$page = $smcFunc['db_fetch_row']($request);
$smcFunc['db_free_result']($request);
if (!empty($page))
sportal_parse_page($page[0], $page[1]);
else
echo 'Page load has failed.';



Just change mysample from the top of the code to the page ID that you are attempting to display.

Regards.
Title: Re: Show page in block?
Post by: hebron on August 06, 2014, 04:16:03 PM
Perfect, works like a charm. Thanks  :D
SimplePortal 2.3.8 © 2008-2024, SimplePortal