Forum Index >  glFusion >  glFusion Support New Topic Post Reply
 What's New in the Center Block?
   |  Printable Version
By: deklan (offline)  Sep 12 2008 17:05 pm (Read 1967 times)  
deklan

Is there a way to get my What's New block displayed in the center block or in a static page somehow?

I find that, at least on my site, the thing people are most looking for is the newest articles and comments. Some of the less savvy users have commented that they didn't even notice the What's Newest block on the right side. I want to get those articles auto-populating to the center of the page, using whatever approach is necessary, so that the full titles (and as an enhancement request, I think the intro text should maybe be displayed as well) are displayed in a prominent and inviting way.

I'd even like to have some graphics associated with the stories but it seems to me that glfusion is a long way from being able to do that.

Basically, I want my site to look like any other news portal- like a magazine page that provides teasers for articles and links to the full text. If I can just get the What's new Block in the center, I'd be one step closer to that goal.

www.FreeSpeak.TV

Forum Junior
Junior

Group Comfort
Level:
: 0

Registered: 06/22/08
Posts: 19

Profile Email    
  Quote
By: Mark (offline)  Sep 14 2008 09:24 am  
Mark

You can put What's New in a center block by using a Static Page.

1. Create a static page
2. Check the 'Centerblock' checkbox
3. Select PHP: Execute PHP

Make the contents of the static page like this:

PHP Formatted Code

echo COM_whatsNewBlock();
 



And there you have it, a center block with the latest items. You can tweak the static page settings like 'in a block' to turn on / off the page title, etc.

Thanks!
Mark

Forum Admin
Admin

Group Comfort
Level:
: +110

Registered: 10/21/05
Posts: 6311
Location: The Great State of
Texas

Profile      
  Quote
By: Geiss (offline)  Sep 14 2008 09:24 am  
Geiss

Is there a way to get my What's New block displayed in the center block or in a static page somehow?



Sure thing. Although it probably won't end up looking the way you'd like. :wink: First, make sure you've enabled the use of PHP in staticpages, and then create a static page and call the function that creates the What's New block, like this:

PHP Formatted Code
echo COM_whatsNewBlock();



Then, set it to display as a centerblock, uncheck the wrap in a block option, and set it to execute PHP, save it and you're done! Big Grin

so that the full titles (and as an enhancement request, I think the intro text should maybe be displayed as well) are displayed in a prominent and inviting way.



This full title code you modified is probably why your comments don't truncate in the block and they spill over outside the edge of the template, like you referred to in your other forum thread. FYI. Big Grin

I'd even like to have some graphics associated with the stories but it seems to me that glfusion is a long way from being able to do that.



You can include any number of graphics in your stories either via the FCKeditor, or the old school imageX upload capability. This isn't a matter of the functionality not being there, it's just that a custom function needs to be created to display the content how you intended.

I would start by copying the function that creates the What's New Stories portion into a new custom function in lib-custom.php, and then add in the intro-text ability by pulling those values out of the database. Be wary though of including images if you are giving others control over their stories, not only for the obvious indecent image potential reasons, but simply because if the images aren't all exactly the same size and in the same position for all your stories, the display will look like garbage. If you're planning on moderating all that and doing all the editorial and layout work, then you should be ok. Big Grin

There are plans in the roadmap for v1.2 to separate the Stories from the core code, and to move it into its own plugin. Perhaps once you tweak your custom function, you could share it with the rest of the community and it could become part of that new plugin proper. Please add a entry to the Tracker about it, so it won't be forgotten. :wink:

Thx!

Eric


Forum Active Member
Active Member

Group Comfort
Level:
: +58

Registered: 02/15/07
Posts: 2097
Location: Boise, Idaho

Profile Email Website  
  Quote
By: deklan (offline)  Sep 14 2008 22:03 pm  
deklan

Thanks for the detailed instructions, but alas, I can't get it to work. I have the centerblock enabled.

When I have "PHP return" enabled, my static page doesn't show at all. When I just have "Execute" it displays this error:
Parse error: syntax error, unexpected '<' in /home/freespea/private/plugins/staticpages/functions.inc(1187) : eval()'d code on line 1

I'm looking forward to delving into the rest of your suggestions and helping with some of the image coding, but for now, I need to get past this step of course.

Forum Junior
Junior

Group Comfort
Level:
: 0

Registered: 06/22/08
Posts: 19

Profile Email    
  Quote
By: Geiss (offline)  Sep 14 2008 22:58 pm  
Geiss

Make sure your Post Mode is set to HTML Formatted, not the Advanced Editor when entering PHP code. If you use the Advanced Editor, it wraps it in a < p > tag which throws the error. Big Grin

Thx!

Eric


Forum Active Member
Active Member

Group Comfort
Level:
: +58

Registered: 02/15/07
Posts: 2097
Location: Boise, Idaho

Profile Email Website  
  Quote
By: jmucchiello (offline)  Sep 14 2008 23:09 pm  
jmucchiello

Quote by: Geiss

Make sure your Post Mode is set to HTML Formatted, not the Advanced Editor when entering PHP code. If you use the Advanced Editor, it wraps it in a < p > tag which throws the error. Big Grin

Any way to detect that setting before launching the advanced editor (feature request perhaps I have no idea as I don't use the advanced editor anywhere).

Forum Active Member
Active Member

Group Comfort
Level:
: +2

Registered: 05/15/07
Posts: 445

Profile Email    
  Quote
By: Geiss (offline)  Sep 14 2008 23:50 pm  
Geiss

Any way to detect that setting before launching the advanced editor (feature request perhaps I have no idea as I don't use the advanced editor anywhere).



You tell me! :wink: Sounds like a great feature if it can be done!

Put it in the Tracker so we don't forget! It's these little things that go a long way with end users. Big Grin

Thx!

Eric


Forum Active Member
Active Member

Group Comfort
Level:
: +58

Registered: 02/15/07
Posts: 2097
Location: Boise, Idaho

Profile Email Website  
  Quote
By: Anonymous: deklan ()  Sep 16 2008 14:43 pm  
Anonymous: deklan

Sorry but this still isn't working with HTML mode. I've tried both versions of the run PHP setting. I read the descriptions on these but can't make much sense of them to know which one I should be using. Here's my HTML code with the PHP script at the end:

PHP Formatted Code
<p>&nbsp;</p>
<p style="text-align: center"><a target="_self" href="http://www.freespeak.tv/index.php?topic=ExternalNews"><img height="200" alt="External News" hspace="5" width="200" vspace="5" src="http://www.freespeak.tv/images/library/image/ExternalNews.jpg" /></a><a target="_self" href="http://www.freespeak.tv/index.php?topic=OpEd"><img height="200" alt="Opinion Editorials" hspace="5" width="200" align="baseline" vspace="5" src="http://www.freespeak.tv/images/library/image/OpinionEditorials.jpg" /></a><a target="_self" href="http://www.freespeak.tv/index.php?topic=NewsI-Views"><img height="200" alt="News and I-Views" hspace="5" width="200" vspace="5" src="http://www.freespeak.tv/images/library/image/I-Views(1).jpg" /></a></p>
echo COM_whatsNewBlock();


       
  Quote
By: Mark (offline)  Sep 16 2008 14:54 pm  
Mark

You really can't mix HTML and PHP without some special magic Smile

Try this:

PHP Formatted Code

echo '<p>&nbsp;</p>
<p style="text-align: center"><a target="_self" href="http://www.freespeak.tv/index.php?topic=ExternalNews"><img height="200" alt="External News" hspace="5" width="200" vspace="5" src="http://www.freespeak.tv/images/library/image/ExternalNews.jpg" /></a><a target="_self" href="http://www.freespeak.tv/index.php?topic=OpEd"><img height="200" alt="Opinion Editorials" hspace="5" width="200" align="baseline" vspace="5" src="http://www.freespeak.tv/images/library/image/OpinionEditorials.jpg" /></a><a target="_self" href="http://www.freespeak.tv/index.php?topic=NewsI-Views"><img height="200" alt="News and I-Views" hspace="5" width="200" vspace="5" src="http://www.freespeak.tv/images/library/image/I-Views(1).jpg" /></a></p>';
echo COM_whatsNewBlock();
 



Set PHP to Execute PHP (return).

I think this will get you going.

Thanks!
Mark

Forum Admin
Admin

Group Comfort
Level:
: +110

Registered: 10/21/05
Posts: 6311
Location: The Great State of
Texas

Profile      
  Quote
By: Anonymous: deklan ()  Sep 16 2008 17:01 pm  
Anonymous: deklan

Tried both PHP settings and nothing displays at all. No errors, just nothing (except my ads, which, do you think might be causing problems?)


       
  Quote
By: Mark (offline)  Sep 16 2008 19:41 pm  
Mark

Very odd, I took the code that I posted for you, put it in a static page and what I get is 3 big icons (your links) and below the What's new block. I'm not sure what would prevent it from displaying on your site.... Here is a screen shot of what my page looks like (click on the picture for a larger image):

Click on image to download

Forum Admin
Admin

Group Comfort
Level:
: +110

Registered: 10/21/05
Posts: 6311
Location: The Great State of
Texas

Profile      
  Quote
By: Anonymous: deklan ()  Sep 16 2008 20:06 pm  
Anonymous: deklan

I tried the exact settings you have but it still won't work. I noticed you have an option to make page searchable. I don't.

What version are you on? I'm on glfusion 1.0.0. Should that matter?


       
  Quote
By: jasonhackwith (offline)  Sep 21 2008 12:21 pm  
jasonhackwith

The way that Geeklog/glFusion handles the display of blocks has always been a frustration to me, especially the display of the "What's New" block. Here's a little more information on setting this up.

Make sure you have PHP in staticpages enabled. What I do is create a new security group called StaticPagesPHP and add the staticpages.PHP permission to it. That way, you can control who has access to PHP in staticpages... root does by default when the staticpages.PHP permission is enabled.

Make sure that HTML Formatted is selected, not Advanced Editor, and place the following in the static page:

PHP Formatted Code

echo COM_whatsNewBlock('','Latest Posts');
 



or, if you want to call it "What's New," you would code it as:

PHP Formatted Code

echo COM_whatsNewBlock('','What\'s New');
 



Notice that I've added an array in the ( ). The first ' ', which is currently blank, enables the help icon with a link to a specified help page. For example:

PHP Formatted Code

echo COM_whatsNewBlock('/help/whatsnew.html','Latest Posts');
 



I usually leave the help link blank. The second part of the array contains the block title.

Make sure that "Wrap Static Page in a Block" is deselected, or you'll have two blocks, one nested inside the other. Change PHP to "execute PHP (return)."

Now, here's the frustrating part. The What's New block is coded differently than the rest of the core system blocks in lib-common.php. Instead of just displaying the block contents, it will display a complete block no matter where you put it. This is incredibly frustrating when you're trying to place multiple blocks on a custom homepage; the formatting is all messed up because it'll put a block title there even if you don't want one.

Here's an example of the above in action:
http://jasonhackwith.com/staticpages/in ... atestposts

For a more concrete example of what else you can do with this, see: http://www.intotheflame.com/. The homepage is a staticpage set to display as the entire homepage. The What's New block is on the top left, followed by the Latest Events block. The Popular Articles block is a custom one that displays the latest articles weighted by number of hits.

Now, what I like to do is a little different, and involves more of a setup but makes for easier editing later. I create a series of custom autotags using the Autotags plugin that call these various blocks. Here's the code from the homepage of IntoTheFlame.com:

PHP Formatted Code

<div class="homepage-container">
<table cellpadding="0" cellspacing="0" border="0" width"100%"><tr>
<td class="homepage-left" valign="top"><div class="story-featured"><h1>Welcome to ITF!</h1></div>[whatsnew:homepage-rss Latest Posts]<div style="width:98%;clear:both;">&nbsp;</div><h2>Upcoming Events</h2>[calendar:homepage-cal]<div style="width:98%;clear:both;">&nbsp;</div></td>
<td class="homepage-right" style="text-align:center;" valign="top"><div class="homepage-media" style="font-size:.8em;"><h1>Featured Media: &nbsp; &nbsp; <small><a href="/media/album.php?aid=10&page=1">watch more</a></small></h1><h2 style="width:460px">Nick Vujicic's Testimony: Life Without Limbs</h2><div style="text-align:left;color:white;padding:5px;"><div style="padding:5px;clear:all;background-color:#fec25a;color:black;margin:5px;">[video:20080607141340913 autoplay:0]What an incredible man of God... what a testimony. You can find out more about Nick at <a href="http://www.lifewithoutlimbs.org">LifeWithoutLimbs.org</a>.&mdash; Jason</div></div><br style="clear:both;"></div><h2 style="text-align:left;">Popular Articles</h2><div style="width:98%;clear:both;text-align:left;">[poparticles:homepage-rss]</div><p align="center">&middot; <a href="/directory.php">Browse Article Directory</a></p></td>
</tr>
</table>
<div class="homepage-footer"><div class="story-body"><p>[image:20070505113634344 align:left border:0 width:95 link:2]Who are we?  We are a group of desperate people hungry after a dangerous God.  Sinners all, we seek the Sinless.  Stagnant, we seek the Author of real change.  Suffering, we seek the only Source of true comfort.</p>
<p>We aren't satisfied with the status quo, the safety of empty tradition, or the pat answers of those who try to deny that suffering exists.  We don't want a program, a package, or another parcel of empty promises.  We want God Himself. &middot; [staticpage:community read more]</a></p></div></div>
</div>
 

"Beauty... is the shadow of God on the universe." ~ Gabriela Mistral -- DesolacĂ­on
Forum Active Member
Active Member

Group Comfort
Level:
: +8

Registered: 02/12/06
Posts: 144
Location: Lewiston, Idaho

Profile Email Website  
  Quote
By: jmucchiello (offline)  Sep 21 2008 13:04 pm  
jmucchiello

Quote by: jasonhackwith

The way that Geeklog/glFusion handles the display of blocks has always been a frustration to me, especially the display of the "What's New" block. Here's a little more information on setting this up.

I agree. I wish the builtin blocks were just phpblock_blockname style blocks. That would solve lots of stupid issues with them.

Forum Active Member
Active Member

Group Comfort
Level:
: +2

Registered: 05/15/07
Posts: 445

Profile Email    
  Quote
New Topic Post Reply


 All times are CDT. The time is now 10:36 pm.
Normal Topic Normal Topic
Locked Topic Locked Topic
Sticky Topic Sticky 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 
HTML Allowed 
Censored Content