Welcome to Geeklog, Anonymous Thursday, March 28 2024 @ 09:33 am EDT

Geeklog Forums

Portal block in center

Page navigation


Status: offline

jlhughes

Forum User
Full Member
Registered: 04/25/02
Posts: 154
artistic
I want to create several portal blocks in the center.

Since the standard blocks only appear left and right, can I use a PHP staticpage?

If so, what PHP function do I need to call to get the portal block info in the staticpage?
 Quote

Status: offline

Blaine

Forum User
Moderator
Registered: 07/16/02
Posts: 1232
Location:Canada
John,

Would it not be better to just create a php script and use the COM_siteHeader() and COM_siteFooter() functions to wrap geeklog around this content ?

Is it necessary to still have the other center page content like articles on this page?
Geeklog components by PortalParts -- www.portalparts.com
 Quote

Status: offline

comicbookguy

Forum User
Regular Poster
Registered: 05/15/04
Posts: 97
If you want to have news feeds in the center of your page try the MyHeadlines plugin.
 Quote

Status: offline

jlhughes

Forum User
Full Member
Registered: 04/25/02
Posts: 154
Quote by Blaine: John,

Would it not be better to just create a php script and use the COM_siteHeader() and COM_siteFooter() functions to wrap geeklog around this content ?

Is it necessary to still have the other center page content like articles on this page?


I have four soccer-related Geeklog sites, each producing its own unique content and maintaining a geeklog.rdf file.

I have a Geeklog main site, unrelated to the soccer sites, where I have work-related projects.

Rather than having a long right (or left) column of feeds from each site, I would prefer a center block. (I may want it always at the top or maybe at the bottom. Haven't decided.)


 Quote

Status: offline

samstone

Forum User
Full Member
Registered: 09/29/02
Posts: 820
First create a portal block, and remember the block ID number, which is shown in the URL when you edit the block. You can deactivate the block after you see it is working correctly, so that it will not display in the columns.


Place the following code in lib-custom.php

Text Formatted Code

// Custom RDF / RSS feed on static page
function static_rdf($blockid = false) {
        $error = array();
        if ($blockid != false && is_numeric($blockid) && $blockid != "") {
                global $_TABLES;
                if (DB_getItem( $_TABLES['blocks'], 'type', "bid = '{$blockid}'" ) == 'portal') {                      
                        $sql = "SELECT UNIX_TIMESTAMP(rdfupdated) as date, content, rdfurl FROM {$_TABLES['blocks']} WHERE bid = '" . $blockid . "'";
                        $result = DB_query( $sql );
                        $A = DB_fetchArray( $result );
                        if ( COM_rdfCheck($blockid, $A['rdfurl'], $A['date'] ))
                        {
                                $A['content'] = DB_getItem( $_TABLES['blocks'], 'content',
                                                        "bid = '{$blockid}'" );
                        }
                        $return = $A['content'];
                } else {
                        $error[] = 'Block is not of Portal Type';
                }
        } else {
                $error[] = 'Is not a valid BlockID';
        }
        if (count($error) > 0) {
                $return = "Something is wrong with the blockid that you entered.  Fix this.  Otherwise there could be issues";
                $return .= '<ul>';
                for ( $x = 0; count($error) > $x; $x++ ) {
                        $return .= '<li>' . $error[$x] . '</li>';
                }
                $return .= "</ul>";
        }
        return $return;
}
 



Create a center block and place the following code


Text Formatted Code
$return = static_rdf('##'); return $return;
 


## must be replaced by the block ID for the portal block you created.

Select the "Execute PHP" for the StaticPages. And make it center block.

The RDF should now be shown on the center block.

Sam
 Quote

Status: offline

jbpaul17

Forum User
Chatty
Registered: 05/14/04
Posts: 49
Location:New York City
samstone,

How do I create a center block? Do you mean static page? Where is the setting for "Execute PHP" for Static Pages?
 Quote

Gavin

Anonymous
Quote by jbpaul17: samstone,

How do I create a center block? Do you mean static page? Where is the setting for "Execute PHP" for Static Pages?


Yep staticpage center block with php, you can see it at The Ould Sod. I have 4 portal blocks in the center there.
 Quote

Status: offline

samstone

Forum User
Full Member
Registered: 09/29/02
Posts: 820
I like your center block. It was quite creative. I have never tried the php codes mixed with table in static pages. So did you just use
Sam
 Quote

Status: offline

jbpaul17

Forum User
Chatty
Registered: 05/14/04
Posts: 49
Location:New York City
Where is the setting for "Execute PHP" for Static Pages?
 Quote

Gavin

Anonymous
Quote by jbpaul17: Where is the setting for "Execute PHP" for Static Pages?

Look in the Docs
 Quote

Status: offline

jbpaul17

Forum User
Chatty
Registered: 05/14/04
Posts: 49
Location:New York City
right on, thanks!
 Quote

Status: offline

jbpaul17

Forum User
Chatty
Registered: 05/14/04
Posts: 49
Location:New York City
i've made the various updates/changes that are mentioned in this forum posting, but get the following message:

Parse error: parse error, unexpected '

you can see it at:
http://jeffandcrystal.com/staticpages/index.php?page=ESPN
 Quote

Status: offline

sakuny

Forum User
Junior
Registered: 02/05/04
Posts: 29
Quote by samstone: First create a portal block, and remember the block ID number, which is shown in the URL when you edit the block. You can deactivate the block after you see it is working correctly, so that it will not display in the columns.


Place the following code in lib-custom.php

Text Formatted Code

// Custom RDF / RSS feed on static page
function static_rdf($blockid = false) {
        $error = array();
        if ($blockid != false && is_numeric($blockid) && $blockid != "") {
                global $_TABLES;
                if (DB_getItem( $_TABLES['blocks'], 'type', "bid = '{$blockid}'" ) == 'portal') {                      
                        $sql = "SELECT UNIX_TIMESTAMP(rdfupdated) as date, content, rdfurl FROM {$_TABLES['blocks']} WHERE bid = '" . $blockid . "'";
                        $result = DB_query( $sql );
                        $A = DB_fetchArray( $result );
                        if ( COM_rdfCheck($blockid, $A['rdfurl'], $A['date'] ))
                        {
                                $A['content'] = DB_getItem( $_TABLES['blocks'], 'content',
                                                        "bid = '{$blockid}'" );
                        }
                        $return = $A['content'];
                } else {
                        $error[] = 'Block is not of Portal Type';
                }
        } else {
                $error[] = 'Is not a valid BlockID';
        }
        if (count($error) > 0) {
                $return = "Something is wrong with the blockid that you entered.  Fix this.  Otherwise there could be issues";
                $return .= '<ul>';
                for ( $x = 0; count($error) > $x; $x++ ) {
                        $return .= '<li>' . $error[$x] . '</li>';
                }
                $return .= "</ul>";
        }
        return $return;
}

 



Create a center block and place the following code


Text Formatted Code
$return = static_rdf('##'); return $return;

 


## must be replaced by the block ID for the portal block you created.

Select the "Execute PHP" for the StaticPages. And make it center block.

The RDF should now be shown on the center block.

Sam


Sam, I'm confused. Does this mean there are three center blocks created: 2 with code snippets for RDF feed and 1 Static Page?

And which PHP code did Gavin use to get blocks in center. Do I use the code that normally goes in lib-custom.php? (that didn't seem to work. i got errors.) Or am I missing something entirely different.

this is very helpful so thanks for any suggestions you have. i'm not a programmer, so i'm just trying to read between the lines and follow instructions.
 Quote

Status: offline

samstone

Forum User
Full Member
Registered: 09/29/02
Posts: 820
This code does exactly what the topic says.

The purpose is to let you create a staticpage that shows the RSS feeds.

You need to first create the potal block you want and hide them, since you don't want to display the block, by unchecking the "enable" box. However, you need to remember the block's id. The above code would pull the content of that box and display in the staticpages you create with that method.

You can place the staticpage wherever the static page can be put, top, after feature story, at the bottom, or taking entire page.

Hope this helps!

Sam
 Quote

Status: offline

jbpaul17

Forum User
Chatty
Registered: 05/14/04
Posts: 49
Location:New York City
I belive I've followed your instructions properly samstone, but i'm still getting an error:

Fatal error: Call to undefined function: static_rdf() in /home/jeffand/public_html/staticpages/index.php(84) : eval()'d code on line 1

Any thoughts?

(Error's can be viewed at: http://jeffandcrystal.com/staticpages/index.php?page=ESPN)
 Quote

Status: offline

ronack

Forum User
Full Member
Registered: 05/27/03
Posts: 612
K, I had to select Execute PHP (return) for it to work. But it did work as advertised.
 Quote

Status: offline

sakuny

Forum User
Junior
Registered: 02/05/04
Posts: 29
Quote by samstone: This code does exactly what the topic says.

The purpose is to let you create a staticpage that shows the RSS feeds.

You need to first create the potal block you want and hide them, since you don't want to display the block, by unchecking the "enable" box. However, you need to remember the block's id. The above code would pull the content of that box and display in the staticpages you create with that method.


Sam


Okay, seems I also had to select the "Execute PHP (return)" option.

So I now realize that a separate question is how to get regular blocks (and plugins) to show up in the Center block just like its done here on Geeklog. My issue wasn't initially about the RSS feed, though I can now make good use of this across multiple planned sites.

The docs explain that you can use the Static Pages for Center blocks, but not how. What text do I put in the static page to get a block to show up there?

Thanks for your help!
 Quote

Status: offline

ronack

Forum User
Full Member
Registered: 05/27/03
Posts: 612
It just means that you can put a static page in your the center. However now with this putting a feed in the center is super.

Now I just tried something and that was to try and put 2 RSS feeds in one center block side by side or in line one below the other. It didn't work for some reason.
 Quote

Status: offline

samstone

Forum User
Full Member
Registered: 09/29/02
Posts: 820
The docs explain that you can use the Static Pages for Center blocks, but not how. What text do I put in the static page to get a block to show up there?


Some people do read the docs! You miss intepret the "Center blocks." It simply mean you can put the staticpages in the center and in stead of taking the whole page you can set it at the top, after the feature, or at the bottom. That's all it means, and you seem to have done it.

As I said, the code is for the topic. If you want blocks other than the Portal Blocks to show in the staticpages, you need to do it differently based on the type of the block you are trying to move. Not all blocks are the same.

For example, if you want the sections block in the middle, just create the html links. Simple.

Sam
 Quote

Status: offline

samstone

Forum User
Full Member
Registered: 09/29/02
Posts: 820
Now I just tried something and that was to try and put 2 RSS feeds in one center block side by side or in line one below the other. It didn't work for some reason.


To put one below another, simply create two staticpages stacking up one over the other.

The following code places three portal blocks in two columns because the first two blocks has 5 headlines each and the third has 10. Just to give you a sample:

Text Formatted Code
echo "<table width='100%'><tr><td width='50%'>" . static_rdf('22'). static_rdf('23') . "</td>";
echo "<td width='50%' bgcolor='#F7F7F7'>" . static_rdf('21') . "</td></tr></table>";

 


You need to choose "execute php" without return.
 Quote

Page navigation

All times are EDT. The time is now 09:33 am.

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