Welcome to Geeklog Sunday, May 19 2013 @ 03:13 AM EDT
|
||||||||
![]() |
Forum Index > General Discussions > Feedback |
New Topic
|
Post Reply
|
staticpages.php and block function |
|||
| ivy |
|
||||||
![]() ![]() ![]() ![]() ![]() Full Member ![]() ![]() Status: offline ![]() Registered: 11/25/04 Posts: 136 |
staticpages php is very usefull.
example... Portal blocks PHP Formatted Code echo DB_getItem( 'gl_blocks', 'content',"bid = '**'");bid is block id. phpblock: PHP Formatted Code echo phpblock_polls();echo phpblock_themetester(); and so on... user_block PHP Formatted Code echo COM_showBlock('user_block');admin_block PHP Formatted Code echo COM_showBlock('admin_block');section_block PHP Formatted Code echo COM_showBlock('section_block');events_block PHP Formatted Code echo COM_showBlock('events_block');whats_new_block PHP Formatted Code echo COM_showBlock('whats_new_block');Geeklog Japanese http://www.geeklog.jp |
||||||
|
|||||||
| koalasoft |
|
||||||
![]() ![]() ![]() ![]() ![]() Full Member ![]() Status: offline ![]() Registered: 03/09/05 Posts: 236 |
as I can see block customized, to if?
PHP Formatted Code echo DB_getItem( 'gl_blocks', 'content',"bid = 'My_block'"); ond PHP Formatted Code echo COM_showBlock('My_block');this last one does not show anything Greetings !! **Cuando el Alumno esta listo, el Maestro Aparece ** ::Geeklog support in Spanish:: |
||||||
|
|||||||
| samstone |
|
||||||
![]() ![]() ![]() ![]() ![]() Full Member ![]() Status: offline ![]() Registered: 09/29/02 Posts: 820 |
The bid is found on the url when you are editing the block. It's not something you can name.
Sam |
||||||
|
|||||||
| koalasoft |
|
||||||
![]() ![]() ![]() ![]() ![]() Full Member ![]() Status: offline ![]() Registered: 03/09/05 Posts: 236 |
and where I look for the URL of block, single I see when publishing the name of block customized. for example:
PHP Formatted Code echo COM_showBlock('block_name_customized');Greetings!! **Cuando el Alumno esta listo, el Maestro Aparece ** ::Geeklog support in Spanish:: |
||||||
|
|||||||
| LWC |
|
||||||
![]() ![]() ![]() ![]() ![]() Full Member Status: offline ![]() Registered: 02/19/04 Posts: 811 |
This portal staticpage presents a problem - it just takes information from the current real portal block - with an emphasis on "current". So although it allows you to hide the real block and yet bypass its permissions and get its feed to the staticpage, if you want to keep the feed updated, it means one thing:
you must have the same feed both in a staticpage and in the left/right block around it - and who would want to do that? If it isn't hidden, the way I see it there are 2 solutions: make a staticpage that implements its own version of COM_rdfImport or... Steps to make a staticpage portal for BOTH hidden and none hidden portal blocks:
I haven't tested it yet - can anybody try and report back? |
||||||
|
|||||||
| tmarquez |
|
||||||
![]() ![]() ![]() ![]() ![]() Regular Poster ![]() Status: offline ![]() Registered: 06/17/03 Posts: 70 |
I was able to take what you have LWC and make it work, how ever the one SQL statement was wrong:
PHP Formatted Code $sql = "SELECT type, content, rdfur, date, rdflimit WHERE bid = '$bid'"; I corrected it to this: PHP Formatted Code // Gather parameters for the portal block $sql = "SELECT type, content, rdfurl, rdfupdated , rdflimit FROM $_TABLES[blocks] WHERE bid = $bid"; Also, it should be noted that the field bid is going to be a numeric value, so $bid = 'test' should be $bid = 123 for example. Thanks, I couldn't do the RSS feed without you! Also, if you want to format it, to keep a consistent look with the rest of your geek log blocks, do this before you go into the RSS code : PHP Formatted Code $display .= COM_startBlock('RSS FEED', '','blockheader-left.thtml'); Or of course, come with a completely different template to use for the news feed!!! Love this geeklog! Now if I could only post engough so that my title on these forums wasn't "chatty"! T.Marquez Jr. - Webmaster - www.indianapolisfilm.net - Geeklog 1.4.0sr5-1 |
||||||
|
|||||||
| LWC |
|
||||||
![]() ![]() ![]() ![]() ![]() Full Member Status: offline ![]() Registered: 02/19/04 Posts: 811 |
Alright, I've fixed all the problems that tmarquez raised with my portal staticpage, and even allowed format options.
Also, now you just need to know the block's name and not its bid. PHP Formatted Code // http://lior.weissbrod.com presents... // A portal staticpage (that bases itself on a user created proper portal block) // Version 0.5 global $_TABLES; $display = ''; // Needed parameters - start // Enter your Portal Block's unique name (configurable in the block editor) $name = 'test'; // Do you want to embed the feed inside a block - true/false? $block_embed = 1; // If so, choose which block - left/right or blank for a general block. $block_type = ''; // Also if so, choose a title for the block $block_title = "RSS Feed"; // Needed parameters - end if ($block_embed && ($block_type == "left" || $block_type == "right")) { $block_header = "blockheader-{$block_type}.thtml"; $block_footer = "blockfooter-{$block_type}.thtml"; } $bid = DB_getItem( $_TABLES['blocks'], 'bid', "name = '$name'"); // If it's disabled/hidden, do its job for it if (!DB_getItem( $_TABLES['blocks'], 'is_enabled', "bid = '$bid'")) { // Gather parameters for the portal block $sql = "SELECT type, bid, rdfurl, rdfupdated as date, rdflimit FROM {$_TABLES['blocks']} WHERE bid = '$bid'"; $result = DB_query( $sql ); $A = DB_fetchArray( $result ); // Update the hidden block if needed COM_formatBlock($A, true); } else $A['bid'] = $bid; // Finally, paste the feed $A['content'] = DB_getItem( $_TABLES['blocks'], 'content', "bid = '{$A['bid']}'"); if ($block_embed) { if (isset($block_header)) $display .= COM_startBlock($block_title, '',$block_header); else $display .= COM_startBlock($block_title, ''); } $display .= $A['content']; if ($block_embed) { if (isset($block_header)) $display .= COM_endBlock($block_footer); else $display .= COM_endBlock(); } echo $display; |
||||||
|
|||||||
| koalasoft |
|
||||||
![]() ![]() ![]() ![]() ![]() Full Member ![]() Status: offline ![]() Registered: 03/09/05 Posts: 236 |
Hi!!
This Working in Geeklog 1.7.2 ?? How?? this example NOT working PHP Formatted Code echo DB_getItem( 'gl_blocks', 'content',"bid = '**'");bid is block id. but, this yes .. PHP Formatted Code echo COM_showBlock('user_block');all in staticpages and enabled php Greetings!! **Cuando el Alumno esta listo, el Maestro Aparece ** ::Geeklog support in Spanish:: |
||||||
|
|||||||
| ::Ben |
|
||||||
![]() ![]() ![]() ![]() ![]() Full Member ![]() Status: offline ![]() Registered: 01/14/05 Posts: 1359 |
Hi,
This is working: PHP Formatted Code echo DB_getItem( 'gl_blocks', 'content',"bid = '105'");Where 105 is my block id. Do not include bid is block id. in your code. ::Ben We speak french on http://geeklog.fr |
||||||
|
|||||||
| Content generated in: 3.37 seconds |
|
|
|