Topics

User Functions

Events

There are no upcoming events

What's New

Stories

No new stories

Comments last 2 weeks

No new comments

Trackbacks last 2 weeks

No new trackback comments

Links last 2 weeks

No recent new links

NEW FILES last 14 days

No new files

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
 06/05/06 10:44PM (Read 4177 times)  
+++++
Full Member
angelic

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
 
Profile Email Website
 Quote
koalasoft
 08/19/06 01:48PM  
+++++
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::
 
Profile Email Website
 Quote
samstone
 08/19/06 02:03PM  
+++++
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

 
Profile Email
 Quote
koalasoft
 08/19/06 02:28PM  
+++++
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::
 
Profile Email Website
 Quote
LWC
 11/07/06 11:57AM  
+++++
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:

  1. Build yourself a real portal block.

  2. If you want the actual portal block to be hidden (so the feed would only show up in the staticpage), do the following:
    1. Disable the portal block (this makes it hidden).
    2. You might as well leave its topic on "All" since I shall totally ignore it anyway (staticpages [when used as centerblocks] have their own topic setting).

  3. Write the following in your PHP enabled staticpage:
    PHP Formatted Code
    // http://lior.weissbrod.com presents...
    // A staticpage frontend for portal blocks
    // Version 0.1

    // Needed paramters - start
    // Enter Your Portal Block's ID
    // (configurable in the block editor)
    $bid = 'test';
    // Needed paramters - end

    // 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, content, rdfur, date, rdflimit
    WHERE bid = '$bid'"
    ;
        $result = DB_query( $sql );
        $A = DB_fetchArray( $result );
        $A['bid'] = $bid;

    // Since COM_formatBlock completely ignores its $noboxes
    // (set to true below) paramter and takes it directly
    // from $_USER['noboxes']...
        $userboxes_backup = $_USER['noboxes'];
        $_USER['noboxes'] = true;

    // Update the hidden block if needed
        COM_formatBlock($A, true);

    // Again, because the above true was ignored
        $_USER['noboxes'] = $userboxes_backup;
    } else
        $A['bid'] = $bid;

    // Finally, paste the feed
                $A['content'] = DB_getItem( $_TABLES['blocks'], 'content',
                                            "bid = '{$A['bid']}'");
    echo $A['content'];
     


I haven't tested it yet - can anybody try and report back?

 
Profile Email Website
 Quote
tmarquez
 12/03/06 06:09PM  
++++-
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
 
Profile Email Website
 Quote
LWC
 04/15/08 09:43AM  
+++++
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;
 

 
Profile Email Website
 Quote
koalasoft
 02/26/11 11:45AM  
+++++
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!! Mr. Green

**Cuando el Alumno esta listo, el Maestro Aparece ** ::Geeklog support in Spanish::
 
Profile Email Website
 Quote
::Ben
 02/27/11 01:04PM  
+++++
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
 
Profile Email Website
 Quote
Content generated in: 3.37 seconds
New Topic Post Reply

Normal Topic Normal Topic
Sticky Topic Sticky Topic
Locked Topic Locked Topic
New Post New Post
Sticky Topic W/ New Post Sticky Topic W/ New Post
Locked Topic W/ New Post Locked Topic W/ New Post
View Anonymous Posts 
Able to post 
Filtered HTML Allowed 
Censored Content