pluck
pluck 4.7 out now, download it today!

pluck support forums

for all your questions about the easiest CMS on the planet

You are not logged in.

Announcement

New registrations are disabled for some spam problems. New registrations will be avaliable soon. If you want to help to keep forum away from spam - contact us.
Please post your bug reports on Launchpad.

#1 14-09-2009 15:11:44

luna72
Member
Registered: 14-09-2009
Posts: 8

Blog questions

Hello,

I just installed Pluck and so far it is really nice, very simple but I just need it for some news on my website.

I am using the Blog tool for this, and now I have 2 questions:

1. Can u disable the comments/box completly? I don't want people to make comments about my blogs/news.

2. Can you have lets say 5 entries per page and then page numbers at the bottom?

Thanks
Luna

Last edited by luna72 (14-09-2009 15:11:59)

Offline

#2 14-09-2009 15:21:30

jellisontech
Member
From: Maine
Registered: 10-01-2009
Posts: 99

Re: Blog questions

Hi, luna72.  Welcome!

Pluck is a great tool.  Right now, there is no pagination (I'm looking for a solution as well).  It's a feature for 4.7 I believe, but there's no release date yet.

You can disable comments but it requires modifying some of the code.  Do you know PHP?  I would suggest making a backup of your files first.

I'm not the greatest with PHP but this is something I did right away.  I also found a post with the code to "shorten" the article so you would have a "read more" button.  Is this also something you would like?

If so, I can try to help you with the code.  smile  Just let me know.  I'll check your post again in a little while.

Offline

#3 14-09-2009 15:24:58

luna72
Member
Registered: 14-09-2009
Posts: 8

Re: Blog questions

Hey thanks for the quick answer. Oh yar I found the other post as well about shorten the entries, I will definately use that too.

I know PHP a little bit, I am not a programmer but I know how to modify the code if I get the snips and a short description what to replace smile

Offline

#4 14-09-2009 15:37:08

luna72
Member
Registered: 14-09-2009
Posts: 8

Re: Blog questions

about this http://www.pluck-cms.org/forum/viewtopic.php?id=571 ... I tried the second solution but I miss the "read more" on the bottom of the postings... I know you can click on the title but it would be nicer to have this as well.

Thought I might as well ask this here as the original post is a bit older smile

Offline

#5 14-09-2009 15:44:37

jellisontech
Member
From: Maine
Registered: 10-01-2009
Posts: 99

Re: Blog questions

I'll answer this as best I can.  It might now be 100% right but it seems to work for me (so far, knock on wood).  I'll break this up in sections so it's not one big jumble of words.

1.  Backup your Blog folder (make a copy, just incase).
2.  There are 3 files you need to change - functions.php, viewpost.php & blog_include.php
3.  Write a News article to test the new settings.

Offline

#6 14-09-2009 15:46:47

jellisontech
Member
From: Maine
Registered: 10-01-2009
Posts: 99

Re: Blog questions

functions.php

Open this file & add this code:

function cutString($txt,$x) {
$tlen = strlen($txt);
if($x < 1) return '';
if($x >= $tlen - 1) return $txt;
while ($txt{$x} != ' ' && ++$x < $tlen);
$new = substr($txt, 0, $x);
return $new.'<b> . . . </b>';
}

before the ?>

Offline

#7 14-09-2009 15:48:26

jellisontech
Member
From: Maine
Registered: 10-01-2009
Posts: 99

Re: Blog questions

viewpost.php (inside the pages_site folder)

Open this file & replace entire code with this:

<?php
/*
* This file is part of pluck, the easy content management system
* Copyright (c) somp (www.somp.nl)
* http://www.pluck-cms.org

* Pluck is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.

* See docs/COPYING for the complete license.
*/

//Make sure the file isn't accessed directly
if((!ereg("index.php", $_SERVER['SCRIPT_FILENAME'])) && (!ereg("admin.php", $_SERVER['SCRIPT_FILENAME'])) && (!ereg("install.php", $_SERVER['SCRIPT_FILENAME'])) && (!ereg("login.php", $_SERVER['SCRIPT_FILENAME']))){
    //Give out an "access denied" error
    echo "access denied";
    //Block all other code
    exit();
}

//Predefined variable
$post = $_GET['post'];
$pageback = $_GET['pageback'];
?>

<div class="blogpost">
    <span class="postinfo" style="font-size: 10px;">
        <?php echo $lang_blog14; ?> <span style="font-weight: bold;"><?php echo $post_category; ?></span> - <?php echo $post_month; ?>-<?php echo $post_day; ?>-<?php echo $post_year; ?>, <?php echo $post_time; ?>
    </span><br /><br />
    <?php echo $post_content; ?>
</div>

<div style="margin-top: 10px;">
    <span style="font-size: 19px"></span>

<?php
//Then show the reactions
//Check if there are reactions
if(isset($post_reaction_title)) {
    foreach($post_reaction_title as $key => $value) { ?>
<div class="blogpost_reaction" style="margin-bottom: 15px; margin-top: 5px;">
    <span class="posttitle" style="font-size: 16px;">
        <?php echo $post_reaction_title[$key]; ?>
    </span><br />

    <span class="postinfo" style="font-size: 10px;">
        <span style="font-weight: bold;"><?php echo $post_reaction_name[$key]; ?></span> -  <?php echo $post_reaction_month[$key]; ?>-<?php echo $post_reaction_day[$key]; ?>-<?php echo $post_reaction_year[$key]; ?>, <?php echo $post_reaction_time[$key]; ?>
    </span><br />
    <?php echo $post_reaction_content[$key]; ?>
</div>
    <?php }
}

//Show a form to post new reactions
?>

   
</div>

<?php
//If form is posted...
if(isset($_POST['Submit'])) {

    //Check if everything has been filled in
    if((!isset($_POST['title'])) || (!isset($_POST['name'])) || (!isset($_POST['message']))) { ?>
        <span style="color: red;"><?php echo $lang_contact6; ?></span>
    <?php
        exit;
    }

    else {
        //Then fetch our posted variables
        $title = $_POST['title'];
        $name = $_POST['name'];
        $message = $_POST['message'];

        //Check for HTML, and eventually block it
        if ((ereg('<', $title)) || (ereg('>', $title)) || (ereg('<', $name)) || (ereg('>', $name)) || (ereg('<', $message)) || (ereg('>', $message))) { ?>
            <span style="color: red;"><?php echo $lang_blog22; ?></span>
        <?php }

        //If no HTML is present
        else {
            //Delete unwanted characters
            $title = stripslashes($title);
            $title = str_replace('"', '', $title);
            $name = stripslashes($name);
            $name = str_replace('"', '', $name);
            $message = stripslashes($message);
            $message = str_replace('"', '', $message);
            $message = str_replace("\n", '<br />', $message);

            //Strip slashes from post itself too
            $post_title = stripslashes($post_title);
            $post_title = str_replace("\"", "\\\"", $post_title);
            $post_category = stripslashes($post_category);
            $post_category = str_replace("\"", "\\\"", $post_category);
            $post_content = stripslashes($post_content);
            $post_content = str_replace("\"", "\\\"", $post_content);

            //Determine the date
            $day = date("d");
            $month = date("m");
            $year = date("Y");
            $time = date("H:i");

            //Then, save existing post information
            $file = fopen('data/settings/modules/blog/posts/'.$post, 'w');
            fputs($file, '<?php'."\n"
            .'$post_title = "'.$post_title.'";'."\n"
            .'$post_category = "'.$post_category.'";'."\n"
            .'$post_content = "'.$post_content.'";'."\n"
            .'$post_day = "'.$post_day.'";'."\n"
            .'$post_month = "'.$post_month.'";'."\n"
            .'$post_year = "'.$post_year.'";'."\n"
            .'$post_time = "'.$post_time.'";'."\n");

            //Check if there already are other reactions
            if(isset($post_reaction_title)) {
                foreach($post_reaction_title as $reaction_key => $value) {
                    //Set key
                    $key = $reaction_key + 1;
                    //And save the existing reaction
                    fputs($file, '$post_reaction_title['.$reaction_key.'] = "'.$post_reaction_title[$reaction_key].'";'."\n"
                    .'$post_reaction_name['.$reaction_key.'] = "'.$post_reaction_name[$reaction_key].'";'."\n"
                    .'$post_reaction_content['.$reaction_key.'] = "'.$post_reaction_content[$reaction_key].'";'."\n"
                    .'$post_reaction_day['.$reaction_key.'] = "'.$post_reaction_day[$reaction_key].'";'."\n"
                    .'$post_reaction_month['.$reaction_key.'] = "'.$post_reaction_month[$reaction_key].'";'."\n"
                    .'$post_reaction_year['.$reaction_key.'] = "'.$post_reaction_year[$reaction_key].'";'."\n"
                    .'$post_reaction_time['.$reaction_key.'] = "'.$post_reaction_time[$reaction_key].'";'."\n");
                }
            }       

            //If this is the first reaction, use key '0'
            else {
                $key = 0;
            }

            //Then, save reaction
            fputs($file, '$post_reaction_title['.$key.'] = "'.$title.'";'."\n"
            .'$post_reaction_name['.$key.'] = "'.$name.'";'."\n"
            .'$post_reaction_content['.$key.'] = "'.$message.'";'."\n"
            .'$post_reaction_day['.$key.'] = "'.$day.'";'."\n"
            .'$post_reaction_month['.$key.'] = "'.$month.'";'."\n"
            .'$post_reaction_year['.$key.'] = "'.$year.'";'."\n"
            .'$post_reaction_time['.$key.'] = "'.$time.'";'."\n"
            .'?>');
            fclose($file);
            chmod('data/settings/modules/blog/posts/'.$post,0777);

            //Redirect user
            redirect('?module=blog&page=viewpost&post='.$post.'&pageback='.$pageback,'0');
        }
    }
}
?>

<p><a href="?file=<?php echo $pageback; ?>">&lt;&lt;&lt; <?php echo $lang_theme12; ?></a></p>

Offline

#8 14-09-2009 15:49:49

jellisontech
Member
From: Maine
Registered: 10-01-2009
Posts: 99

Re: Blog questions

blog_include.php (inside the pages_site folder)

Open this file & replace entire code with this:

<?php
/*
* This file is part of pluck, the easy content management system
* Copyright (c) somp (www.somp.nl)
* http://www.pluck-cms.org * Pluck is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.

* See docs/COPYING for the complete license.
*/

//Make sure the file isn't accessed directly
if((!ereg("index.php", $_SERVER['SCRIPT_FILENAME'])) && (!ereg("admin.php", $_SERVER['SCRIPT_FILENAME'])) && (!ereg("install.php", $_SERVER['SCRIPT_FILENAME'])) && (!ereg("login.php", $_SERVER['SCRIPT_FILENAME']))){
    //Give out an "access denied" error
    echo "access denied";
    //Block all other code
    exit();
}

include("data/modules/blog/functions.php");//Display existing posts, but only if post-index file exists
if (file_exists('data/settings/modules/blog/post_index.dat')) {
    $handle = fopen('data/settings/modules/blog/post_index.dat', 'r');
    while (!feof($handle)) {
        $file = fgets($handle, 4096);
        //Filter out line breaks
        $file = str_replace ("\n",'', $file);
        //Check if post exists
        if ((file_exists('data/settings/modules/blog/posts/'.$file)) && (is_file('data/settings/modules/blog/posts/'.$file))) {
            //Include post information
            include_once('data/settings/modules/blog/posts/'.$file);
            ?>
            <div class="blogpost" style="margin-top: 20px">
                <span class="posttitle" style="font-size: 18px;">
                    <a href="?module=blog&amp;page=viewpost&amp;post=<?php echo $file; ?>&amp;pageback=<?php echo $current_page_filename; ?>"><?php echo $post_title; ?></a>
                </span><br />
                <span class="postinfo" style="font-size: 10px;">
                    <?php echo $lang_blog14; ?> <span style="font-weight: bold;"><?php echo $post_category; ?></span> - <?php echo $post_month; ?>-<?php echo $post_day; ?>-<?php echo $post_year; ?>, <?php echo $post_time; ?>
                </span>
                <br /><br />
                <?php echo cutString($post_content,200); ?>
                    <a href="?module=blog&amp;page=viewpost&amp;post=<?php echo $file; ?>&amp;pageback=<?php echo $current_page_filename; ?>">Read More</a><p></p>
       
            </div>
            <?php
        }
    }
    //Close module-dir
    fclose($handle);
}
?>

You should be all set.  Happy for anyone to correct me on this method.

Offline

#9 14-09-2009 15:52:08

jellisontech
Member
From: Maine
Registered: 10-01-2009
Posts: 99

Re: Blog questions

Oh, and this does add a "read more" to the posts.  It's hardcoded in the end of the file so it will show up after the "..."

Also, if you want longer or shorter posts, change the "200" to something else.  It would be this line, in the blog_include.php file:

<?php echo cutString($post_content,200); ?>

Offline

#10 14-09-2009 16:08:51

luna72
Member
Registered: 14-09-2009
Posts: 8

Re: Blog questions

That's great help thanks so much... roll

I just have to find out about pagination now. I know I wrote something for a guestbook years ago, it was very easy for a friend who knows a bit of php, maybe someone has already a solution? big_smile

Last edited by luna72 (14-09-2009 16:09:23)

Offline

#11 14-09-2009 16:20:08

jellisontech
Member
From: Maine
Registered: 10-01-2009
Posts: 99

Re: Blog questions

If I find a way to add pagination (or if anyone else does), I'll post it on the forums.

Also if you are looking for a guestbook, I'm working on a module for that now.  Take a look:

http://www.pluck-cms.org/forum/viewtopic.php?id=553

It's not done yet but any info on it will be in that post.

Good luck with your site!

Offline

#12 14-09-2009 16:32:50

luna72
Member
Registered: 14-09-2009
Posts: 8

Re: Blog questions

Thanks you, currently I don't need a guestbook but who knows... smile

Offline

#13 17-09-2009 08:33:56

luna72
Member
Registered: 14-09-2009
Posts: 8

Re: Blog questions

Hey me again..

I figured out one major problem with cutting down the text like this.

I tried to use tables inside my blog for better formatting and now it shortens the text in the middle of the table code, which affects the layout

<div class="blogpost" style="margin-top: 20px">
<span class="posttitle" style="font-size: 18px;">
<a href="?module=blog&amp;page=viewpost&amp;post=tabellen-news-test.php&amp;pageback=kop2.php">Tabellen News Test</a>
</span><br />
<span class="postinfo" style="font-size: 10px;">
veröffentlicht in <span style="font-weight: bold;">News</span> - 09-17-2009, 08:05                    </span>
<br /><br />
Test mit Tabellen, erstmal Text ohne Tabelle<br />laal lala test test test test test test test test test<br /><br />
<table style="height: 385px;" border="0" cellspacing="0" cellpadding="25" width="786">
<tbody>
<tr>
<td><img<b> . . . </b>                       
<a href="?module=blog&amp;page=viewpost&amp;post=tabellen-news-test.php&amp;pageback=kop2.php">Read More</a><p></p>
</div>
<div class="blogpost" style="margin-top: 20px">
<span class="posttitle" style="font-size: 18px;">
<a href="?module=blog&amp;page=viewpost&amp;post=noch-mehr-neuigkeiten-von-nota-inustra.php&amp;pageback=kop2.php">Noch mehr Neuigkeiten von Nota Inustra</a>
</span><br />

Anyone know how to solve this problem?

thx
Luna

Offline

#14 17-09-2009 20:47:49

jellisontech
Member
From: Maine
Registered: 10-01-2009
Posts: 99

Re: Blog questions

Well, a couple of problems ...  first, you should try to avoid using tables when possible.  Style a div instead.  It's more flexible.  That being said, I do occasionally use tables. smile

The biggest issue I can see is the table height.  Is there a reason that you want the table only that tall?  If not, try making the height 100%.  That should fix it. 

If you have to have the table exactly that height, trying adding overflow: auto; to your style.  It should make a scroll bar for the content.  You might need to add it to the td tag instead of the table tag.  You'll have to play around with it some.

Last option, shorten the post length.  Instead of 200, try 150 or 100 to see if it fixes the problem (the code is in the blog_include.php file).

Hope it helps.

If someone else knows a better solution, please let me know.

Offline

#15 18-09-2009 13:03:03

luna72
Member
Registered: 14-09-2009
Posts: 8

Re: Blog questions

Hello there, the problem was in the php script that we added. Using the trunc function and telling the script to ignore the table td tr tags worked.

The tables are from pluck, the editor in pluck has the option to create tables so I need to avoid those mistakes smile I do not use tables in my layout though....

Click on "Medien" and you see the script working. Don't watch the layout too closely, its just to test the functions...for now

http://www.dnnet.de/nota/

Luna

Last edited by luna72 (18-09-2009 13:13:01)

Offline

#16 18-09-2009 17:57:39

jellisontech
Member
From: Maine
Registered: 10-01-2009
Posts: 99

Re: Blog questions

Coming along very nicely.  How'd you get it to do pagination?  I've been trying to figure it out.

Offline

#17 22-09-2009 07:22:58

JGMetcalfe
Member
Registered: 12-07-2008
Posts: 29

Re: Blog questions

I've had a quick read of the above and am not sure if the above code actually splits up a page... If it does ok, DOH.

if not then a question. As we admin the site and add the blogs, couldn't we add a page break code (marker if you like) between blogs, and the scripts could then generate a new page? Please don't ask me how hmm

for example ( from a wordpress blog site )
=======================================
It’s possible to using <–nextpage–> WordPress Quicktags to paginate a blog post in WordPress post or page so that an article can be split into two or more multiple pages.
=======================================

Offline

#18 22-09-2009 11:15:20

jellisontech
Member
From: Maine
Registered: 10-01-2009
Posts: 99

Re: Blog questions

The code I gave does not split pages, but on luna72's site, it shows multiple pages.  So I'm wondering how it was done.  I've tried a few things but haven't figured it out yet.

Offline

#19 22-09-2009 15:04:03

luna72
Member
Registered: 14-09-2009
Posts: 8

Re: Blog questions

Hey, a friend who is php programmer changed a few things in my php files. If someone is interested, I could only send you the fully changed files, so you won't have comments anymore either.
Just send me a PM with your email address.

Offline

#20 22-09-2009 15:06:31

jellisontech
Member
From: Maine
Registered: 10-01-2009
Posts: 99

Re: Blog questions

Awesome!  I just sent you an email.  smile

Offline

#21 31-10-2009 23:02:09

sk8rjess
Member
Registered: 14-05-2008
Posts: 17

Re: Blog questions

just thought i'd share here as well i just finished adding pagination to a site i'm working on for a client.
the site isnt done, i'm still adding alot of features but the pagination is done.
jack.ctxdesigns.com

Offline

#22 16-06-2010 18:48:23

a_bach
developer/module guru
From: Poland
Registered: 24-11-2008
Posts: 439
Website

Re: Blog questions

Becouse many people ask on this forum about blog module - pagination and more, i have modified module to do so...

http://www.pluck.ekyo.pl/downloads/blogs.tar.gz

http://en.pluck.ekyo.pl/5.Modules.php

Pagination, configuration, short messages...

Code dont look as good as should but its working.

I also added bloglinks module to this pack.

A_Bach

Offline

Board footer

Powered by FluxBB