Hi,
I am new to Fuel CMS. I am trying to explore the blog module and how to modify it. Basically, I want to create a two column page in the form of a blog where the left column (sidebar) will display the archives and also the posts (in a preview format) in a vertical layout. On clicking on one of these previews posts we will get a detailed post on the right column. It will not change the whole page in the blog. How can I achieve this?
Essentially, an affect like this:
http://3.bp.blogspot.com/-lNkPQU2kVz0/USeI51ork9I/AAAAAAAAK-4/bc1LEy2nhRc/s640/bonepress-free-wordpress-theme.PNGThanks
Comments
I want to open individual blog post within the same page (where the list of posts are shown) within a div element rather than having it open in a new page. Is there a way to do that?
Thanks.
With regards to loading in the blog post on the same page, are you wanting to AJAX in the content of that blog post to that page? If so, you can create a controller that allows you to pass it a blog post ID and returns the data for that post which you can inject into that page... very similar to what the blog.php controller does in the "post" method but without the header and footer content attached to it (since it's AJAXed in).
In posts.php under views,
div id="left"
<?php echo $this->fuel_blog->sidemenu(array('archives'))?> //Left div
/div
div id="detail" //Right div to show detail
/div
Then in posts.php under _blocks, I do this:
a href="javascript:ajaxpage('<?=$post->url?>', 'detail');"><?=$post->title?>
ajaxpage is a javascript function that will return the post (i think) and put the returned content in the "detail" div.
http://pastie.org/private/03xu5qpiwsmqotwyq2xqq
Does this sound right? The problem i am having is that header and footer seem to be messing up my css.
http://api.jquery.com/load/
I have another question to ask:
So, I have the two div layout as I described before in the blog module that works ok if I don't use any images. Now, when I create the blog post with some image added to the post content area, I want my image to appear only in the right div. Currently, it appears in both left and right div's which messes up my css. Any thoughts?
Thanks!
If you are using the 1.0 beta, there is a "_stripped" formatter you can use:
<?php echo $post->content_stripped?>
Also, one more question, I cannot get to cover the whole background of the left sidebar with color. The color only displays till the text content. Any thoughts about it?
I tried to use <?php echo $post->content_stripped?> to remove images from the left sidebar but that removes the content also. I can just see the title. Can I do something else?
Thanks
tags to be removed?
1. There is a strange space between the post title and post content on the left side div element even though I have kept the margin as 0px.
2. Another feature I would like to add is a "newer entries" and "older entries" link to the right div so I can browse through them without clicking on links separately on the left. Also, if I click on archives for a month on the left side bar, the "older or newer entries" section would only display posts from that month.
/blog/2013/05/ (month)
/blog/2013/ (year)
If you are wanting the archives, that will present a grouping of posts by month and year on a page using the $this->fuel_blog->get_post_archives() method.
The fuel/modules/blog/libraries/Fuel_blog class has several methods on it that may help you to grab the proper posts.
$next_post = $this->fuel_blog->get_next_post(); <a href="<?=$next_post->url?>">NEXT</a>
A PHP Error was encountered
Severity: Notice
Message: Trying to get property of non-object
I supply the $posts as argument to get_next_post()
I actually have two pages where $post as argument works for one page but doesn't work for the first or the last post. It works fine for the middle posts.