Posted on: 06/24/04 02:50pm
By: jlhughes
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?
Portal block in center
Posted on: 06/24/04 03:59pm
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?
Portal block in center
Posted on: 06/24/04 04:05pm
By: comicbookguy
If you want to have news feeds in the center of your page try the MyHeadlines plugin.
Portal block in center
Posted on: 06/24/04 04:15pm
By: jlhughes
[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?[/QUOTE]
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.)
Portal block in center
Posted on: 08/02/04 10:07pm
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
// 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
$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
Portal block in center
Posted on: 12/22/04 12:14pm
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?
Portal block in center
Posted on: 12/22/04 12:44pm
By: Anonymous (Gavin)
[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?[/QUOTE]
Yep staticpage center block with php, you can see it at
The Ould Sod[*1] . I have 4 portal blocks in the center there.
Portal block in center
Posted on: 12/22/04 01:12pm
By: samstone
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
Portal block in center
Posted on: 12/23/04 10:19am
By: jbpaul17
Where is the setting for "Execute PHP" for Static Pages?
Portal block in center
Posted on: 12/23/04 04:33pm
By: Anonymous (Gavin)
[QUOTE BY= jbpaul17] Where is the setting for "Execute PHP" for Static Pages?[/QUOTE]
Look in the Docs[*2]
Portal block in center
Posted on: 12/23/04 05:12pm
By: jbpaul17
right on, thanks!
Portal block in center
Posted on: 12/23/04 05:23pm
By: jbpaul17
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
Portal block in center
Posted on: 12/29/04 11:57pm
By: sakuny
[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
// 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
$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]
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.
Portal block in center
Posted on: 12/30/04 11:21am
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.
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
Portal block in center
Posted on: 12/30/04 12:22pm
By: jbpaul17
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)
Portal block in center
Posted on: 12/30/04 01:47pm
By: ronack
K, I had to select Execute PHP (return) for it to work. But it did work as advertised.
Portal block in center
Posted on: 12/30/04 01:59pm
By: sakuny
[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[/QUOTE]
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!
Portal block in center
Posted on: 12/30/04 02:11pm
By: ronack
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.
Portal block in center
Posted on: 12/30/04 02:27pm
By: samstone
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
Portal block in center
Posted on: 12/30/04 02:33pm
By: samstone
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:
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.
Portal block in center
Posted on: 12/30/04 02:33pm
By: sakuny
[QUOTE BY= ronack] 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]
I understand that this script puts and RSS feed in the center block, but if you look at the earlier post by Gaving and see his site at:
Ould Sod then you'll see what I mean about putting other blocks in the center. He also uses tables to put multiple blocks. (Did you try inserting the code into tables to get more than one RSS feed?)
On the front page of Geeklog, the Forum block is in the center. I'm assuming this is a staticpage being used somehow.
Portal block in center
Posted on: 12/30/04 02:48pm
By: samstone
I just posted a reply right before your post that has to do with part of your question. Ould Sod has a stack of RSS feed in his staticpage.
Other than that the weather is a link from a weather site. It is not a center block of the GL weather block. All you need is to get the code from the weather site and drop it in.
The random photo is from the gallery. I don't know how he coded it in, but if I had to do such thing, I would use the method posted
at this link.[*3]
The point is there is no one size fit all code for you to put everything you want in the static page, you have to find a way to do for each individual case.
As for the forum center block, it has nothing to do with the staticpages, it was part of the forum features.
Sam
Portal block in center
Posted on: 12/30/04 02:50pm
By: Dirk
[QUOTE BY= sakuny] On the front page of Geeklog, the Forum block is in the center. I'm assuming this is a staticpage being used somehow.[/QUOTE]
No, that's a feature of the forum plugin.
Currently, only plugins can display content in center blocks (that's how static pages can be displayed in a center block in the first place ...).
bye, Dirk
Portal block in center
Posted on: 12/31/04 04:03am
By: samstone
Just corrected my reply to Ronack.
Portal block in center
Posted on: 12/31/04 01:39pm
By: jbpaul17
All,
I appreciate all the followups on this topic, but my question still remains... I'm getting the error message:
Fatal error: Call to undefined function: static_rdf() in
/home/jeffand/public_html/staticpages/index.php(84) : eval()'d code on line
1
And can be viewed at:
http://jeffandcrystal.com/staticpages/index.php?page=ESPN[*4]
I've set up a static page with the following code within it (20 being the code for the portal block previously created for the non-enabled ESPN RSS feed):
$return = static_rdf('20'); return $return;
I have not allowed the static page to wrap text, I've selected the "execute PHP" (not "execute PHP (return)") option, and not selected the "Exit Type" option.
I've pasted the appropriate code within /public_html/system/lib-custom.php. However, I still can only manage to ge the above mentioned error message. Any thoughts?
Any assistance would be greatly appreciated, thanks!
Jeff.
Portal block in center
Posted on: 12/31/04 02:44pm
By: samstone
Make sure that the code is correctly pasted in. The error says that the static_rdf is not defined. Have you tried "echo static_rdf('20');"?
I've pasted the appropriate code within /public_html/system/lib-custom.php.
It is quite unusual for me to see the 'system' folder in the 'public_html' instead of "Geeklog" directory. I see all your system files by going there.
Sam
Portal block in center
Posted on: 12/31/04 08:35pm
By: sakuny
[QUOTE BY= samstone] I just posted a reply right before your post that has to do with part of your question. Ould Sod has a stack of RSS feed in his staticpage.
Other than that the weather is a link from a weather site. It is not a center block of the GL weather block. All you need is to get the code from the weather site and drop it in.
The random photo is from the gallery. I don't know how he coded it in, but if I had to do such thing, I would use the method posted
at this link.[*3]
The point is there is no one size fit all code for you to put everything you want in the static page, you have to find a way to do for each individual case.
As for the forum center block, it has nothing to do with the staticpages, it was part of the forum features.
Sam[/QUOTE]
aaah, thanks so much for giving me a more complete understanding to work with.
now i can tinker with it myself and figure out which items i can get to display there.
Portal block in center
Posted on: 12/31/04 09:54pm
By: drshakagee
The code for the static page on theouldsod.com is:
$display .='<div style="float:left; margin:5px; width:45%;">';
$display .= COM_startBlock ('Random Sod Shot');
$display .= phpblock_galleryRandomPhoto();
$display .= COM_endBlock();
$display .= COM_startBlock ('Latest Sod News');
//$display .= phpblock_phpicalendar();
$display .= static_rdf('18');
$display .= COM_endBlock();
$display .= COM_startBlock ('Weather at the Sod');
$display .= '<div class="jetbarweather"><a href="http://www.jetbar.com/cgi-bin/weather/hw3.cgi?zipcode=92116" target="_blank" title="Click for full forcast"><img src="http://www.jetbar.com/cgi-bin/weather/hw3.cgi?config=png&zipcode=92116&alt=hwicc" border="0" alt="Current weather at the Sod."></a><br/>Weather by <a href="http://www.jetbar.com/">Jetbar</a></div>';
$display .= COM_endBlock();
$display .='</div>';
$display .='<div class ="alllists">';
$display .= COM_startBlock ('Tonight at the Sod');
$display .= static_rdf('17');
$display .= COM_endBlock();
$display .= COM_startBlock ('This week at the Sod');
$display .= static_rdf('15');
$display .= COM_endBlock();
$display .= COM_startBlock ('San Diego Sports');
$display .= static_rdf('30');
$display .= COM_endBlock();
$display .='</div><div style="clear:both;"></div>';
return $display;
Also you can do things like showing the user functions block like:
$display .= COM_showBlock( user_block, $help='', $title='User Functions' );
If you find out the block names you can show all sorts of other blocks (not all blocks work though).
Gavin
Portal block in center
Posted on: 12/31/04 11:03pm
By: samstone
Thanks for sharing you codes, Gavin. PHP just become more and more interesting to me, so I decided to learn it. Maybe I will become good enough to help the GL team.
One question I have, which is not related to GL here, is the use of "echo" vs. "$display" What's the main difference? I tend to run into error with "$display," so I prefer to use "echo." I know this is not a php lesson site, but just can't withhold my curiousity.
I am about to try getting the events list in the center block. I wonder if you have already tried that and ended up using phpicalendar because having RSS makes things easier.
Happy New Year!
Portal block in center
Posted on: 04/04/05 11:25pm
By: Anonymous (drali)
just a note:
if you wanna put in the code for the center block as samstone suggests, you need to have 'EXECUTE PHP (RETURN)' selected.
if you want to make it show with just 'EXECUTE PHP'...
then you need teh following code:
echo static_rdf('49');
can someone explain this to me further? it works yah...but umm...i need more info. i get scared when things work that i dont totally understand.
the good thing about this version, is that it lets me easily add more text to the return via additional echo statements. before if i added teh echo statements, it would show up ABOVE my page header. yah.
thanks TONS for getting this to work tho! i've been trying to get something like this for more than a year now!! you've made my dreams come true. haha.
Portal block in center
Posted on: 05/17/05 11:18am
By: greenhil
Thanks for the code from the home page of oldsod
everything is working fine except for i am not getting two columns...i assume it is
$display .='';
i assume i need to add some code somewhere else for this to call properly?
Portal block in center
Posted on: 05/29/05 01:14pm
By: Anonymous (Mary Simms)
This is very interesting. I tried MyNewsheadlines, but found it rather confusing. Your script works well. I have only one question. How do you limit the amount of feeds to be displayed?
Portal block in center
Posted on: 05/29/05 01:41pm
By: drshakagee
[QUOTE BY= greenhil] Thanks for the code from the home page of oldsod
everything is working fine except for i am not getting two columns...i assume it is
$display .='';
i assume i need to add some code somewhere else for this to call properly?[/QUOTE]
I think in my style.css file I have the "alllists" class defined to have float:right which give its the two columns.
Portal block in center
Posted on: 05/29/05 01:43pm
By: drshakagee
[QUOTE BY= Mary Simms]
This is very interesting. I tried MyNewsheadlines, but found it rather confusing. Your script works well. I have only one question. How do you limit the amount of feeds to be displayed?[/QUOTE]
When you create a new feed in the content syndication section of the admin panel you can limit the number of items to display in each feed, is that what you mean?
Portal block in center
Posted on: 05/29/05 03:53pm
By: geKow
I also try to "steal" your idea, but I can't get my rdf feeds running in a centerblock that way. It tells me:
Something is wrong with the blockid that you entered. Fix this. Otherwise there could be issues
* Block is not of Portal Type
Portal block in center
Posted on: 05/29/05 04:24pm
By: drshakagee
[QUOTE BY= geKow] I also try to "steal" your idea, but I can't get my rdf feeds running in a centerblock that way. It tells me:
Something is wrong with the blockid that you entered. Fix this. Otherwise there could be issues
* Block is not of Portal Type[/QUOTE]
That is the error you will get if you try to pass the static_rdf function a block id that isn't a portal block. Double check the block id of your portal block and make sure to put that id in the function call here: static_rdf('##'); The ##'s should be replaced with the block id of your portal block.
Portal block in center
Posted on: 05/29/05 04:55pm
By: geKow
ahhh I thought I need the feed ID, but I need to have a real block. Now I know
thx
Portal block in center
Posted on: 05/29/05 08:18pm
By: drshakagee
Oh now I understand, yeah you need to create a standard portal block first then uncheck the enabled box, then pass that block id to the static_rdf function. Sorry I didn't realize what you meant.
Re: Portal block in center
Posted on: 08/18/07 10:28am
By: Anonymous (ishmot)
Works great on my site! Thank you very much!