Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Front page Teasers
#1
A teaser implementation for the front page?
Reply
#2
Exactly what do you mean by teaser?

You can already give the front page a completely different design by putting an extra template file in your theme folder and choosing this one for the index. This is how the official GetSimple website offers a different front page too.
“Don’t forget the important ˚ (not °) on the a,” says the Unicode lover.
Help us test a key change for the core! ¶ Problems with GetSimple? Be sure to enable debug mode!
Reply
#3
Zegnåt Wrote:Exactly what do you mean by teaser?

You can already give the front page a completely different design by putting an extra template file in your theme folder and choosing this one for the index. This is how the official GetSimple website offers a different front page too.


Hiya Zegnat -- teaser are short excerpts of new posts. - Usually the title and the first sentence or paragraph of an article.

You've probably tried Drupal or WordPress or similar CMS, in which, when you create a new page/post, one of the options is to split the body of the article at any given point and post the the title and 'excerpt' on the front page of the installation/site, so that when you create a new page, not only is a new page.xml file created, but the front-page get updated/concatenated to include the excerpt with a link to the full article.
Reply
#4
Aa, now I get it.

Well, you’ll need to query all pages the way you would build a menu. Instead of just reading the information for a menu you’ll also make your script read the description field in which you have written a teaser. Then output that data in the form of a list.

Though this wouldn’t be so hard, there is no script for it released at the moment (as far as I know).
“Don’t forget the important ˚ (not °) on the a,” says the Unicode lover.
Help us test a key change for the core! ¶ Problems with GetSimple? Be sure to enable debug mode!
Reply
#5
I have one implememted on my site

Http://www.digimute.com

rebuilding my laptop at the mo, will post when i'm doNe

mike
My Github Repos: Github
Website: DigiMute
Reply
#6
yeah forget that, I'm using texTile for editing...

I'm adding a random string to pages that I want to print a teaser for , in my case "[***]"

When printing out the page I see if this string exists, if it does I print everything up to the string followed by a link to the full page. I also have fancy URLs turned off...

Code:
echo stripslashes(substr($page['content'],0,strpos($page['content'],"[***]")));
echo "<a href=\"index.php?type=blog&amp;id=".$page['url']."\">Read More....</a>";

When printing the full page I retrieve the full page, and remove the string before echoing.

Code:
if ($_GET['type']=="blog"){
    $content= str_replace("[***]","",$content);
    echo $content;
    }


Simple and no changes need to the backend...

Mike,.,,,
My Github Repos: Github
Website: DigiMute
Reply
#7
I just added a new function to GS called get_page_excerpt($length, $html);

$length = the amount of characters you want in your excerpt. Default = 200
$html = should html be shown or stripped out? Default = FALSE (html is stripped)

This will be part of GS 2.02
- Chris
Thanks for using GetSimple! - Download

Please do not email me directly for help regarding GetSimple. Please post all your questions/problems in the forum!
Reply
#8
ccagle8 Wrote:I just added a new function to GS called get_page_excerpt($length, $html);

$length = the amount of characters you want in your excerpt. Default = 200
$html = should html be shown or stripped out? Default = FALSE (html is stripped)

This will be part of GS 2.02


Great!
Reply
#9
for those who didn't upgraded to 2.02 i'm using this function in theme_functions.php:
Code:
function get_short_content($page){  
        $path = "data/pages";
        $thisfile = @file_get_contents('data/pages/'.$page.'.xml');
        $data = simplexml_load_string($thisfile);
        echo '<p>';
        echo '<b>';
        echo stripslashes(htmlspecialchars_decode($data->title, ENT_QUOTES));
        echo '</b></p><p>'   ;
        echo substr((stripslashes(htmlspecialchars_decode($data->content, ENT_QUOTES))),0,350);;
        echo '.............</p><p>' ;
        echo '<a href="index.php?id='.$page.'">Read more</a></p>' ;
}

and then call in your template or component

Code:
<?php get_short_content('pagetitle');?>

Cheers
Reply




Users browsing this thread: 1 Guest(s)