News:

Want to get involved in developing SMF? Why not lend a hand on our GitHub!

Main Menu

SMFBlog

Started by SMFHacks.com Team, May 11, 2007, 08:02:48 AM

Previous topic - Next topic

spottedhog

GREAT!!!!!!!!!!!!!!!!!!!!!!!!!!  Thanks!!!!!!!!!!!!!  Oh, do not worry about what theme, etc.  All the themes I have are modifications of the default and English Steel themes.  :)

I will now learn the capabilities of $modSettings.

thanks again!

Daniel15

QuoteI will now learn the capabilities of $modSettings.
Basically, all of SMF's main settings are in that array (if you look in the database, it's the whole smf_settings table) :).
Daniel15, former Customisation team member, resigned due to lack of time. I still love everyone here :D.
Go to smfshop.com for SMFshop support, do NOT email or PM me!

spottedhog

ahhhhh...  lesson learned!!!!!!!!!!!!!!  Many possibilities this way.....  hmmmmmmm.....

thanks again!

L.G.S

What would I need to do to add "- X replies" (where X is the amount of replies) to that particular post? I think its confusing for members that they have to guess that by clicking the title they can see the replies also.
FREE and LIVE World Cup + Premier League football streams:

www.gamesandgoals.com


jawohl

I just started using SMFBlog on my site and It works good! Great job!

Just one question. When I click on Blog in the menu it shows the latest 10 entries, but how do users get to the older ones?`I can't find any "next page" or something like that.

Any ideas on what to do?
hojen.nu - hojforum

Daniel15

QuoteWhat would I need to do to add "- X replies" (where X is the amount of replies) to that particular post? I think its confusing for members that they have to guess that by clicking the title they can see the replies also.
Where do you want to add that? In/next to the title of the post, or at the bottom of the post?

QuoteJust one question. When I click on Blog in the menu it shows the latest 10 entries, but how do users get to the older ones?`I can't find any "next page" or something like that.

Any ideas on what to do?
Oops, I knew I forgot something... SMFBlog is very much incomplete at the moment :o.
Sources/Blog.php, find:

// Get all the recent posts (10 of them).

Add before:

// Get the number of posts in this board
$result = db_query("
SELECT COUNT(ID_FIRST_MSG)
FROM {$db_prefix}topics
WHERE ID_BOARD = {$row['ID_BOARD']}", __FILE__, __LINE__);

list ($post_count) = mysql_fetch_row($result);
mysql_free_result($result);

// Construct a page index
// !!! Must fix this... And 10 should NOT be hardcoded! :o
$context['blog']['pageindex'] = constructPageIndex($scripturl . '?action=blog;sa=view_blog;name=' . $row['blog_alias'] . ';start=%d', $_REQUEST['start'], $post_count, 10, true);



Themes/default/Blog.template.php, find:

echo '
<h2>', $context['blog']['name'], '</h2>';

Add after:

// Page numbers, please!
echo '
', $context['blog']['pageindex'];


Find:

$alternating = ($alternating == 1) ? 2 : 1;
}

Add after:

// Page numbers at the bottom
echo '
', $context['blog']['pageindex'];


If you're using pretty URLs, open Sources/QueryString.php, and find:

// The blog itself
$buffer = preg_replace('/"' . preg_quote($scripturl, '/') . '\?action=blog;sa=view_blog;name=([A-Za-z0-9\-_]+)"/', '"' . $boardurl . '/blog/$1/"', $buffer);

Add after:

// A specific page in the blog
$buffer = preg_replace('/"' . preg_quote($scripturl, '/') . '\?action=blog;sa=view_blog;name=([A-Za-z0-9\-_]+);start=([0-9]+)"/', '"' . $boardurl . '/blog/$1/$2.html"', $buffer);

In .htaccess, find:

# Viewing a blog
RewriteRule ^blog/([A-Za-z0-9\-_]+)/$ index.php?action=blog&sa=view_blog&name=$1

Add after:

# A specific page of the blog
RewriteRule ^blog/([A-Za-z0-9\-_]+)/([0-9]+).html$ index.php?action=blog&sa=view_blog&name=$1&start=$2

(the URLs aren't too nice at the moment... I wasn't sure how to structure them :P)
Daniel15, former Customisation team member, resigned due to lack of time. I still love everyone here :D.
Go to smfshop.com for SMFshop support, do NOT email or PM me!

jawohl

Thanks Daniel! That worked great, even if SMFBlog still is very incomplete I really like it! :)
hojen.nu - hojforum

jawohl

Quote from: Daniel15 on June 01, 2007, 04:12:39 AM
QuoteWhat would I need to do to add "- X replies" (where X is the amount of replies) to that particular post? I think its confusing for members that they have to guess that by clicking the title they can see the replies also.
Where do you want to add that? In/next to the title of the post, or at the bottom of the post?


I would like that to show at the bottom of each post. So that the readers can see how many comments a blog-post has without clicking on it.. Get what I mean? :)
hojen.nu - hojforum

KnightRobby

First of all, thanks so much for creating this mod because it is awesome.  :)

However, I am wanting to put users' "Most Recent Blogs" on the front page of the site (like joomlas index.php page, for instance).  Does anyone know how I can go about doing this easily and if they can provide the code?  I am wanting to do something similar to "Most Recent Posts," but instead "10 Most Recent Blogs."  Let me know and I would greatly appreciate it :)

Again, thanks so much!
Robby :D
WebQuad Gaming Community
Sections: Gears of War, Call of Duty 3, and Our Awesome Gaming Community Forums.

vandul

#69
can any one give me an idea how i could include the blog posts on the index page of my site? I tried using php inlcude straight to the blog but it didn't work =P

also I couldn't get pretty URLs to work, /blog and /blog/blogname came up 404 even after i applied the changes to htaccess

CraftyLion

I've just install the mod into my forum and assigned a board as a blog.  However, when I tested it, the board came up fine but the blog itself won't show. Is there a reason for this?

SpelingMistakes

Installing this package will perform the following actions:  Type Action Description
1. Extract File ./Sources/Blog.php 
2. Extract File ./Themes/default/Blog.template.php 
3. Extract File ./Themes/default/blog.css 
4. Execute Modification ./index.php Test successful
5. Execute Modification ./Sources/ManageBoards.php Test successful
6. Execute Modification ./Sources/ModSettings.php Test successful
7. Execute Modification ./Sources/Post.php Test successful
8. Execute Modification ./Sources/QueryString.php Test successful
9. Execute Modification ./Sources/Subs-Boards.php Test successful
10. Execute Modification ./Sources/Subs.php Test successful
11. Execute Modification ./Themes/default/index.template.php Test failed
12. Execute Modification ./Themes/default/ManageBoards.template.php Test successful
13. Execute Modification ./Themes/default/languages/Modifications.english.php Test successful
14. Execute Modification ./Themes/default/languages/Modifications.turkish.php Skipping file
15. Execute Code installScript.php


I have install SSI Topics and Replies, and than I try to install SMFBlog
I use these mods

1. Enhanced Calendar 1.1
2. Order News 1.0.1
3. Increase/Decrease Postbox Size 1.0
4. SMFBlog 0.1 Beta
5. SMF 1.1.1 Update Package 1.1.1
6. SMF 1.1.2 Update Package 1.1.2
7. SSI Topic and Replies 0.1

Not so much of them - I am now under smf 1.1.3


What can cause a problem – What I need to do manually or to make this work?

Spel
There is a huge difference between living and being alive!

TrueSatan

@SpelingMistakes

Please read http://docs.simplemachines.org/index.php?topic=402.msg531#msg531

...and use http://server.daniel15.com/smf/package.php to help you see what changes the mod needs to make.

SpelingMistakes

Hmm I have read whole this topic and I saw almost same problem at the beginning. I noticed that person which has been making this mod ask somebody to send them some from sources folder and indextemplate ... etc.

I am not so familiar with work by hand and I have expect to see what exactly is problem – Maybe my smf version or whatever - I also read that Daniel use this board for support beside its own page for support. I expect it will read and know what is problem – I cant find what is problem – because of that I ask for a help

BTW Other link don't work
There is a huge difference between living and being alive!

TrueSatan

The link that didn't work is mirrored
http://sleepycode.com/index.php?action=modparser


Personally I'm not prepared to go editing custom themes so I always refer people to the official documantation that tells them how to do it for themselves.

SpelingMistakes

i am on 1.1.3 - This dont help - Maybe there is a problem
There is a huge difference between living and being alive!

Daniel15

Sorry about the delay in replying... I'm kinda slow at times  :-\

Quote from: jawohl on June 05, 2007, 03:54:51 PM
Quote from: Daniel15 on June 01, 2007, 04:12:39 AM
QuoteWhat would I need to do to add "- X replies" (where X is the amount of replies) to that particular post? I think its confusing for members that they have to guess that by clicking the title they can see the replies also.
Where do you want to add that? In/next to the title of the post, or at the bottom of the post?


I would like that to show at the bottom of each post. So that the readers can see how many comments a blog-post has without clicking on it.. Get what I mean? :)
Try this:
In Themes/default/Blog.template.php, find:

<div class="blog_post_body" style="padding: 2ex 0;">', $post['body'], '</div>

Add after:

', $post['replies'], ' ', ($post['replies'] == 1 ? $txt['smf_news_1'] : $txt['smf_news_2']), '


QuoteHowever, I am wanting to put users' "Most Recent Blogs" on the front page of the site (like joomlas index.php page, for instance).  Does anyone know how I can go about doing this easily and if they can provide the code?  I am wanting to do something similar to "Most Recent Posts," but instead "10 Most Recent Blogs."  Let me know and I would greatly appreciate it
You mean blog posts, correct? If so...
Quotecan any one give me an idea how i could include the blog posts on the index page of my site?
First, install the ssi_boardNews Multiple Boards mod. I'm guessing you just want the title of the posts? Then, use code similar to this:

<?php
require('SSI.php');

$boards = array();
// Get all the blog boards.
$result = db_query("
SELECT ID_BOARD
FROM
{$db_prefix}boards
WHERE is_blog = 1
ORDER BY name ASC"
, __FILE__, __LINE__);
// Loop through all board IDs
while ($row = mysql_fetch_assoc($result))
$boards[] = $row['ID_BOARD'];

// Get the posts
$posts = ssi_boardNews($boards, 10, null, null, array());
// Loop through all the posts
foreach ($posts as $post)
// Output this post
echo '
<a href="'
, $scripturl, '?action=blog;sa=view_post;id=', $post['id'], '">', $post['icon'], ' ', $post['subject'], '</a> by ', $post['poster']['link'], ' at ', $post['time'], '<br />';
?>


If you want the actual posts themselves, try something like:

<?php
require('SSI.php');

$boards = array();
// Get all the blog boards.
$result = db_query("
SELECT ID_BOARD
FROM
{$db_prefix}boards
WHERE is_blog = 1
ORDER BY name ASC"
, __FILE__, __LINE__);
// Loop through all board IDs
while ($row = mysql_fetch_assoc($result))
$boards[] = $row['ID_BOARD'];

// Get the posts
$posts = ssi_boardNews($boards, 10, null, null, array());
// Loop through all the posts
foreach ($posts as $post)
// Output this post
echo '
<a href="'
, $scripturl, '?action=blog;sa=view_post;id=', $post['id'], '">', $post['icon'], ' ', $post['subject'], '</a> by ', $post['poster']['link'], ' at ', $post['time'], '<br />
<div class="blog_post_body" style="padding: 2ex 0;">'
, $post['body'], '</div>';
?>

Is this what you want, or do you want it formatted differently?

Quotealso I couldn't get pretty URLs to work, /blog and /blog/blogname came up 404 even after i applied the changes to htaccess
Did you try the RewriteBase value (as specified in the .htaccess file). You did call it .htaccess (with a dot as the first character), right?

QuoteI've just install the mod into my forum and assigned a board as a blog.  However, when I tested it, the board came up fine but the blog itself won't show. Is there a reason for this?
What do you mean? What happens when you go to index.php?action=blog? If nothing appears, double-check that you set the board as a blog.

QuoteWhat can cause a problem – What I need to do manually or to make this work?
Just continue the installation, and then manually edit index.template.php (upload the package to http://modparser.dev.dansoftaustralia.net/ and do the index.template.php edit manually).

QuoteThe link that didn't work is mirrored
http://sleepycode.com/index.php?action=modparser
My official one is actually at http://modparser.dev.dansoftaustralia.net/ :)

Quotei am on 1.1.3
It should work fine on SMF 1.1.3. Just continue the installation, and then modify index.template.php manually.

If I missed anyone's question, please feel free to repost it (either here, or at www.daniel15.com). Thanks :)
Daniel15, former Customisation team member, resigned due to lack of time. I still love everyone here :D.
Go to smfshop.com for SMFshop support, do NOT email or PM me!

Matthew Schenker

This looks excellent!!!

Please keep us updated on fixes for 1.1.3 and future versions!

vandul

Thanks Daniel! I wanted the whole post displayed and it worked perfectly
except for this error
Notice: SSI.php was unable to load a session! This may cause problems with logout and other functions - please make sure SSI.php is included before *anything* else in all your scripts! in /home/ljb/public_html/mofov2/forum/SSI.php on line 161

The first file included in my page is for my navigation, is there nyway i can get rid of that?

Yes it's named .htaccess, here's it's contents
RewriteBase /
# Main blog listing
RewriteRule ^blog/$ index.php?action=blog
# Viewing a blog
RewriteRule ^blog/([A-Za-z0-9\-_]+)/$ index.php?action=blog&sa=view_blog&name=$1
# A specific page of the blog
RewriteRule ^blog/([A-Za-z0-9\-_]+)/([0-9]+).html$ index.php?action=blog&sa=view_blog&name=$1&start=$2
# A post in the blog
RewriteRule ^blog/([A-Za-z0-9\-_]+)/post-([0-9]+).html$ index.php?action=blog&sa=view_post&id=$2&blog_name=$1 [QSA]



thanks for the help!

CraftyLion

Quote from: Daniel15
QuoteI've just install the mod into my forum and assigned a board as a blog.  However, when I tested it, the board came up fine but the blog itself won't show. Is there a reason for this?
What do you mean? What happens when you go to index.php?action=blog? If nothing appears, double-check that you set the board as a blog.

Well, that's just it. It doesn't. It just comes up with the board name and description but no posts that show as blogs.

Advertisement: