WebsiteBaker Community Forum

WebsiteBaker Support (2.8.x) => Droplets & Snippets => Topic started by: Eki on June 20, 2007, 11:44:17 AM

Title: Display a Blog menu
Post by: Eki on June 20, 2007, 11:44:17 AM
Hi all,

For my own purpose I wanted to have a block containing a summary of the active groups and also a summary of the history per month of a certain news page. Both summaries should contain the amount of articles and a link to the news page.

So I made a snippet for it, like the AnyNews snippet. Basically I took the anynews snippet and rewrote it, including the readme file. To view the news page with a loop of articles from a certain month, I rewrote the view.php of the news module, giving it the ability to summarize the articles from that particular month (based on the published date or posted date).

I am not much of a good programmer, so the code may be a bit inefficient, but it does the job. So I decided to share it with you guys.

The whole snippet is packed, and can be installed like a module. Then the view.php of the news module needs to be replaced with the included one. After installing the menu can be called from a code section or from the template itself with the following function:

Code: [Select]
display_blog_menu($page_id,$date_option,$group_header,$history_header)
In which:


Hope someone can benefit from it also.

Cheers,
Erik

EDIT: snippet attached in next post
Title: Re: Display a Blog menu
Post by: Eki on June 20, 2007, 11:45:32 AM
Of course I forgot the snippet itself (attached).

EDIT: newer version below

[gelöscht durch Administrator]
Title: Re: Display a Blog menu
Post by: AzAkers on August 03, 2007, 06:13:29 AM
Sounds very close to what I'm looking for on a WB project I'm currently baking

Is there a site where this feature/module is live where we can take a look at it..?
Title: Re: Display a Blog menu
Post by: doc on August 03, 2007, 06:45:01 AM
@Eki
Thanks for your contribution, nice module. Will test it more serious this weekend, maybe we can add it to the Add-Ons page.

Regards Christian
Title: Re: Display a Blog menu
Post by: Eki on August 20, 2007, 04:59:48 AM
Sounds very close to what I'm looking for on a WB project I'm currently baking

Is there a site where this feature/module is live where we can take a look at it..?


Hi,

sorry for the late response, for I've been on Honeymoon the last couple of weeks. You can see a working example at my personal website (http://www.familiepoepchinees.nl)
Just click "weblog"and you will see the addittion on the left column.

regards,
Eki
Title: Re: Display a Blog menu
Post by: DGEC on August 20, 2007, 04:05:32 PM
So on your site you have the News Snippet with the latest posts at the top, and then the category & date summaries underneath then?

That's fantastic!   Thanks so much, and congratulations - just don't spend too much time programming instead of with your bride!  8-)

That really should be integrated into the News and/or Snippet itself.  I definitely want to add this to a site as soon as I get a multiple columns design running.
Title: Re: Display a Blog menu
Post by: jar on September 18, 2007, 11:44:08 PM
Of course I forgot the snippet itself (attached).

hello . i try to use your snipet but does`n work 
I have News Modul v2.6.1.9
Title: Re: Display a Blog menu
Post by: XPfrik on October 06, 2007, 01:00:58 PM
In include.php try to replace all active=true with active=1.

It worked for me.
Title: Re: Display a Blog menu
Post by: AzAkers on October 30, 2007, 04:16:31 PM
Brilliant - just the thing I needed for my logofu.com blog!
Title: Re: Display a Blog menu
Post by: Usta on November 25, 2007, 03:48:33 AM

@Eki,

Great module and great website.

While browsing your website I noticed your attractive photo gallery. I found design very unique and attractive. Can you please give some details on how to implement it?

Thanks!
Usta
Title: Re: Display a Blog menu
Post by: Eki on November 25, 2007, 08:26:17 AM
@Usta,

I am using the Swift Gallery, available at the Add-Ons Repository.

regards,
Erik
Title: Re: Display a Blog menu
Post by: Stefek on January 08, 2008, 09:30:56 PM
Hello Eki - great Modification!
I'll test it in the next day for one of my next project. Also the site itself is nice looking. My compliment!

I'd like to aks you for some advice on how to synchronize the weblog and the rss-feed, as you have done on your page.
Did you make it work automatic? Is there any mod for this purpose?

Thanks,
Stefek
Title: Re: Display a Blog menu
Post by: Eki on January 22, 2008, 06:32:46 AM
Hello @Stefek,

The RSS-feed is dynamicallay generated. The script is already part of the news module. Just call the script with the page_id of your news or blog in the URL, like this:

Code: [Select]
http://www.mysite.com/modules/news/rss.php?page_id=15

Hope this helps.

regards,
Erik
Title: Re: Display a Blog menu
Post by: Stefek on January 22, 2008, 02:56:08 PM
Hello @Stefek,

The RSS-feed is dynamicallay generated. The script is already part of the news module. Just call the script with the page_id of your news or blog in the URL, like this:

Code: [Select]
http://www.mysite.com/modules/news/rss.php?page_id=15

Hope this helps.

regards,
Erik

Yes!
Lots of thanks!

Stefek
Title: Re: Display a Blog menu
Post by: DGEC on February 06, 2008, 11:36:38 PM
Thanks, this is great - it's working quite well. But....  :wink:

1) If you pick a category with no entries, you don't get the breadcrumb links.
Making the breadcrumbs optional would be a good idea too. I'm not sure I like the look of it at the bottom of the menu there. A top and/or bottom flag might be nice?

2) This is more a news question but is there a function to display the latest post by itself?  I.e. I want the News page to display 1-x most recent posts, and then display the menus after that.

I put the blog menu in a code-section at the top of the page, followed by the news section. Works ok, but not the greatest, t's kind of awkward as it is. I think I'll have to figure out how to use content blocks. I'd like to put the category & history side by side, can probably use the DIV.UL I think it was to place them in block mode.
Title: Re: Display a Blog menu
Post by: Eki on February 07, 2008, 08:40:25 AM
@DGEC,

About the breadcrumbs: they are not part of the code snippet itself. The breadcrumbs are being generated by the news module. The change of code to the news section is been made too add breadcrumbs for a certain time-period. For example: News >> February 2008

Regarding showing the latest posts: use the code snippet "Dsiplay News Anywhere". There is also a parameter for showing the title as well as the short description.

Regarding the side-by-side option I would have to take a look back into the code and see if that can be accomplished in an easy way. I think it is a relevant requirement. Maybe adding an extra option to show them vertical or side by side.

regards,
Erik


Title: Re: Display a Blog menu
Post by: Eki on February 07, 2008, 09:48:49 AM
OK, so this was very easy. I added an extra option to show both History and Categories (Groups), or just one of them. I decided to not make an option to show them next to each other, for that would again fix the possibilities. Now it is possible to have the layout you want. So if you want to show the History and Categories next to each other, you could make two <div>-sections and use the code snippet twice, once for the categories only and once for the history only.

Snippet works as follows:

Code: [Select]
display_blog_menu($page_id,$date_option,$group_header,$history_header,$display_option)
In which:

page_id => the news page you want to generate the menu from
date_option => 0:=summarize according posted date (default), 1:=summarize according published date
group_header => header above the group menu (default: '<h1>Categories</h1>')
history_header => header above the group menu (default: '<h1>History</h1>')
display_option =>0:=show both history and categories (default); 1:=show only history; 2:=show only categories

[gelöscht durch Administrator]
Title: Re: Display a Blog menu
Post by: DGEC on February 07, 2008, 10:50:52 PM
re: Display single block - excellent idea!  I was trying to figure out the best way to have a div marker between them, that's perfect.

re: Breadcrumbs - ah! I'd forgotten. Hard to tell after you've installed it already :-)

re: single post - oh!  I'll have to have another look at that, I thought it only prints the title and short_desc, not the long_desc too.

The count by published date is really nice too - I have changed mine to display by published date. Makes much more sense to me. I'll have to make sure this snip excludes future dates.

Thanks!
Title: Re: Display a Blog menu
Post by: spida on July 08, 2008, 10:17:17 PM
Hi Eki,

great snippet! It works instantly (well, so far  8-) )
Just commenting doesn't work anymore. On clicking the "add comment" link the user is redirected to the startpage. Any idea what I could do to enable commenting again?
I am trying to use it in WB 2.7!

Thanks in advance,
spida
Title: Re: Display a Blog menu
Post by: Eki on July 10, 2008, 09:42:48 AM
Hi @Spida,

This is probably because of the included file view.php, which was meant for one of the older versions of teh news module. I would have to check this out, but as I am very busy at the moment this would need some time.

regards,
Erik
 
Title: Re: Display a Blog menu
Post by: spida on July 16, 2008, 07:22:43 PM
Hi Erik,

I know, you've become daddy again, haven't you? Congrats! That IS a busy time, indeed.

Nevertheless, thank you for the cool script and for any future add-ons.

Regards,
spida
Title: Re: Display a Blog menu
Post by: Eki on July 30, 2008, 09:10:31 AM
Hi @spida,

Yes I have!!!. Last friday I've become daddy of a beautiful doughter. And as both mother and doughter are still in the hospital I am indeed still very busy.

But I made a promise to adjust the snippet for WB2.7. And I will fullfill it in the near future.

regards,
Erik
Title: Re: Display a Blog menu
Post by: Luckyluke on July 30, 2008, 10:38:39 AM
Hoi,

Congratulations on this great news!

Dikke proficiat met de dochter!

Groetjes,
Luc
Title: Re: Display a Blog menu
Post by: spida on August 19, 2008, 08:04:38 PM
Any hint, what I should look for in the news.php?
Title: Re: Display a Blog menu
Post by: gemnb on September 15, 2008, 08:21:58 PM
Hi there,
I have a question. I implemented the blog menu in a codepage. When I click an item in the blocksection I've made, the news item appears in the contentbox but the list of history-items in the blocksection disappear (I hope you know what I mean).
How can I change it?

Regards,
Ton
Title: Re: Display a Blog menu
Post by: gemnb on September 17, 2008, 01:16:13 PM
Anyone?
Title: Re: Display a Blog menu
Post by: Stefek on September 17, 2008, 01:30:21 PM
Hi there,
I have a question. I implemented the blog menu in a codepage. When I click an item in the blocksection I've made, the news item appears in the contentbox but the list of history-items in the blocksection disappear (I hope you know what I mean).
How can I change it?

Regards,
Ton
Quote
but the list of history-items in the blocksection disappear
I think it's because your whole page is changed and the "CodePage" is not visible anymore.

The solution is to hardcode your code (you used in the "codePage") into your Template, so it's present all the time onevery page.

May think with this?

Regards,
Stefek
Title: Re: Display a Blog menu
Post by: gemnb on September 17, 2008, 02:50:41 PM
Thanks Stefek for your answer, but I'm still confused.
When looking at Eki's website (http://www.familiepoepchinees.nl), you can go to the weblog menu. On the left you see all the catagories. Clicking one of the items gives a result, but the menu stays.
This isn't hardcoded I assume?

Regards,
Ton
Title: Re: Display a Blog menu
Post by: Stefek on September 17, 2008, 02:51:58 PM
After installing the menu can be called from a code section or from the template itself with the following function:

Code: [Select]
display_blog_menu($page_id,$date_option,$group_header,$history_header)

Hello!
" or from the template itself" means that this is "hardcoded" into the template.  :wink:

Regards,
Stefek
Title: Re: Display a Blog menu
Post by: Stefek on September 17, 2008, 03:10:04 PM
Nevermind.

Will be glad if this solves your problem.  :wink:

Regards,
Stefek
Title: Re: Display a Blog menu
Post by: gemnb on September 17, 2008, 06:14:16 PM
No, but I hope I'll find a way to make it work.   :|
I only want the list to appear when I click the (my own) Archive menu button, not all of the time ( just like it is on Eki's website!).

Regards,
Ton
Title: Re: Display a Blog menu
Post by: gemnb on September 18, 2008, 11:53:22 PM
Well, I can't find the answer (and no one else can, I assume) . So unfortunately there seems to be no solution to this one for now.
I've also tried to create the same situation in WB 2.6.7. (I'm using 2.7), but I got the same result.  :-(

Regards,
Ton
Title: Re: Display a Blog menu
Post by: ghost06 on September 30, 2008, 10:18:16 PM

Snippet works as follows:

Code: [Select]
display_blog_menu($page_id,$date_option,$group_header,$history_header,$display_option)
In which:

page_id => the news page you want to generate the menu from
date_option => 0:=summarize according posted date (default), 1:=summarize according published date
group_header => header above the group menu (default: '<h1>Categories</h1>')
history_header => header above the group menu (default: '<h1>History</h1>')
display_option =>0:=show both history and categories (default); 1:=show only history; 2:=show only categories

I do not succeed to understand what I must put in mine index.php of the template

i have the page whit page_id=1
the media blog is in the section page_id=1#69

what I must insert in mine index.php of my template ones in order to show the menu?

help me plese  :cry: :cry:
Title: Re: Display a Blog menu
Post by: Eki on October 02, 2008, 02:18:37 PM
Hi,

Page_id would be 1 then. Remember that this snippet is not working in WB2.7 yet. Also I have never tested it with the media-blog module.

To be honest I don't like the way this snippet has to be installed (even though I made it myself). It needs to have one of the original files of the news module replaced. And that is the only thing that is of any concern to me. If anybody finds another solution to this, please feel free to adapt the snippet and let me know.

regards,
Erik


Title: Re: Display a Blog menu
Post by: Ruud on October 02, 2008, 05:17:15 PM
On my WB-Tips site (http://WebsiteBaker.allwww.nl/wb/tips.php) I added this too.

This is used in my template. (the news-page has PAGE_ID 8 )
Code: [Select]
               
<?php if (PAGE_ID != 8) {
    
display_news_items();
} else {
    
display_blog_menu(8,1,&#39;<h2>Onderwerpen</h2>&#39;,&#39;<h2>Historie</h2>&#39;);
}?>


Works great - running on WB2.7.

Ruud
Title: Re: Display a Blog menu
Post by: Ruud on October 07, 2008, 10:36:39 AM
Works great - running on WB2.7.

Ok, now I'm feeling a bit guilty a lot.  :oops:
The month selection did not work on a WB2.7 site.

My guilty feeling made me fix the problem and adapt the current news/view.php so it will work with the blog_menu snippet.

Just replace the view.php in the zip in this message with the original news module view.php.
(don't forget to backup the original one)

Now it should work correctly in WB27

Ruud



[gelöscht durch Administrator]
Title: Re: Display a Blog menu
Post by: spida on October 16, 2008, 12:56:57 PM
Hi there,

I am still looking for a possibility to use the commenting function again. There's a little money on the hand to finance the module work-over. Please mail or just post here.

Regards,
spida
Title: Re: Display a Blog menu
Post by: Ruud on October 16, 2008, 01:15:51 PM
Did you use the adapted view.php in 2 posts above?

If so, what exactly is the problem? Maybe I can help.

Ruud
Title: Re: Display a Blog menu
Post by: spida on October 20, 2008, 07:40:50 PM
Hi,

I have exchanged the views.php. However, there is no possibility to comment an article.
Configuration is as follows:

Since the manual says that
Quote
Changing this setting only affects future articles – it will not change the Commenting setting in existing articles!
I entered a new article. No commenting option still. There's only a line beneath the article saying:
Quote
None found
(I guess this means: No comments on this article found).

There, I am lost. Could you please help me? I must have missed something.

EDIT: I am also not sure wich views.php this is exactly. I have tried both, exchanging the views.php in the directory modules/news as well the news-view.php in the directory modules/blog_menu. The same results either way, as described above.

Best regards,
spida
Title: Re: Display a Blog menu
Post by: spida on October 20, 2008, 07:55:00 PM
Hi there,

I think I also discovered a little bug in the module. If you watch an article of a specific group, you'll find a little navigation at the page's top, directing you to the group's overview or to the general article overview. Let's say you want to navigate back to the group's overview, and klick the link. Instead of getting there, you are redirected to the general article overview.

For those not afraid of a German language  ;-) you'll find an example here: http://www.e-daktik.de/pages/posts/erst-mal-kennenlernen4.php?g=6
Klick on "Konzeption" and instead of getting the list of articles in this group, you'll get a list of all articles.

The reason is the wrong URL wich is generated by a script (question is: by which one). The link in my example is
Code: [Select]
http://www.e-daktik.de/pages/artikel.php?g=6?g=6 but ist should be
Code: [Select]
http://www.e-daktik.de/pages/artikel.php?g=6
Where in the module does this needs to be corrected?

I hope I made myself clear, otherwise I will try another explanation, just ask.

Best regards,
spida
Title: Re: Display a Blog menu
Post by: spida on October 22, 2008, 01:26:52 PM
Hello there!

No ideas regarding my two problems? At least the commenting thing seems to be solvable, I am sure I just need a hint on what I am doing wrong.

Cheers,
spida
Title: Re: Display a Blog menu
Post by: spida on October 27, 2008, 04:24:10 PM
Hi there,

this looks a bit like a monologue, but I am still completely stuck, please see my posts earlier about my basic problem.

It might be a very busy time for everybody (as is for me), but I really need your help, pleeeeease.

best regards,
spida
Title: Re: Display a Blog menu
Post by: gemnb on October 27, 2008, 07:21:20 PM
Hi spida,
about the first problem you mentioned, I manually changed my view.php (WB 2.7) and all works well (including the commenting).
The second problem you've got, I also noticed. It's no problem to me for the moment, but it needs to be fixed. Maybe Eki can respond to it (??).

Regards,
Ton
Title: Re: Display a Blog menu
Post by: spida on October 27, 2008, 07:25:09 PM
Hi Ton,

thank your for your reply!
Which view.php did you change (meaning: in which directory)?

Eki is probably too busy with his new baby, changing diapers and all  :-D

Cheers,
spida
Title: Re: Display a Blog menu
Post by: gemnb on October 27, 2008, 09:00:43 PM
spida,
I changed the view.php of the news module directory.

Regards,
Ton
Title: Re: Display a Blog menu
Post by: spida on October 27, 2008, 11:27:28 PM
Hi Ton,

thank your for your advice.
I checked the views.php now but can't figure out what to change. Could you post your changes, please? That would be very helpful.

Best regards,
spida
Title: Re: Display a Blog menu
Post by: gemnb on October 28, 2008, 08:27:12 AM
Hi spida,
you can look at (or use) my version of the view.php (in the news module).

Regards,Ton

[gelöscht durch Administrator]
Title: Re: Display a Blog menu
Post by: Ruud on October 28, 2008, 09:35:04 AM
Guys,

The ?g=3?g=3 is not in the view.php but in the table settings in the backend of WB.
The breadcrumb links are being built from the original link. but when called from a "group link" it will include the group parameter too.

In the post header (settings button of newspage) the links are built using:
Code: [Select]
<td valign="top"><a href="[BACK]">[PAGE_TITLE]</a> >> <a href="[BACK]?g=[GROUP_ID]">[GROUP_TITLE]</a></td>
The [back] link will have the g= parameter (what is not right) and so the second level [back] will have two of them.

Change that line in:
Code: [Select]
<td valign="top"><a href="/pages/artikel.php">[PAGE_TITLE]</a> >> <a href="/pages/artikel.php?g=[GROUP_ID]">[GROUP_TITLE]</a></td>
And it is fixed.
Note: I used /pages/artikel.php in this example because that was in the "problem" page that spida reported. For other site, use whatever link is your news/blog page.

That will fix it.

Ruud
Title: Re: Display a Blog menu
Post by: spida on October 28, 2008, 04:25:04 PM
@Ruud: Perfect! This works! Thank you so much, Ruud.

@Ton: the current news module in the addons directory?
Title: Re: Display a Blog menu
Post by: gemnb on October 28, 2008, 05:41:54 PM
spida,
/modules/news/view.php

Regards,
Ton
Title: Re: Display a Blog menu
Post by: spida on October 29, 2008, 10:35:22 AM
@Ton: I mean: Where do I find YOUR version of the view.php? Is it included in the current news module?
Title: Re: Display a Blog menu
Post by: gemnb on October 29, 2008, 10:45:02 AM
@spida: I don't understand what you mean  :?
Title: Re: Display a Blog menu
Post by: spida on October 29, 2008, 11:04:53 AM
Hi Ton,

never mind, I didn't see the attachment in your earlier post. I'll try it and report.

Thanks for your help,
have a nice day,
spida
Title: Re: Display a Blog menu
Post by: spida on October 31, 2008, 05:31:01 PM
Hi Ton,

I just tried your view.php and still have the same result. At the article's end is only displayed: No comments yet (it actually says "Keine gefunden", since the site is in German).

I really wonder what the cause for my problem might be and would be great if you guys here in the forum could help me further.

These are my settings so far:
- Public commenting enabled for news in news options
- public commenting enabled in specific article
- blog menu in version 0.2 (is there a newer one perhaps?)
- modules/news/view.php as posted above by Ton
- the whole thing under WB 2.7 on a standard *nix web server

I really need the commenting function, thus any further help is very welcome.

Cheers,
spida
Title: Re: Display a Blog menu
Post by: Ruud on October 31, 2008, 05:42:10 PM
What is in your (news) settings page set as comment-footer?
Code: (Should be something like this) [Select]
</table>
<br /><a href="[ADD_COMMENT_URL]">Commentaar toevoegen</a>

It should at least display the "add comment" link. (can we look somewhere?)

I am using the same view.php without problems (example: http://WebsiteBaker.allwww.nl/wb/posts/je-laatste-blog-post-op-de-homepage20.php)

It isn't a blogmenu issue. That one is just displaying links.
It must be something in your news settings.

Ruud
Title: Re: Display a Blog menu
Post by: spida on October 31, 2008, 06:15:25 PM
Hi Ruud,

thank you for your reply.
Actually, my commenting footer is empty, as all the fields in this section of the settings are empty. I must have deleted the contents earlier, stupid me...  :?

I guess I have to re-install the module in this case. And if so, where do I get the module singulary? Or could you give me the field's contents?

EDIT: I installed a new WB on my local server and copied the missing code. Thank you, Ruud, for getting me onto the right track!

Best regards,
spida
Title: Re: Display a Blog menu
Post by: JohnsonY on November 24, 2008, 12:58:35 AM
Hi thanks for the great add-on but I just getting a "bug" with this add-on.

I have setup with 2 languages on the WebsiteBaker. Then I use the following code to display 2 blogs selection with different language. The code is like

Code: [Select]
<?php if (PAGE_ID != 7) { } else { 
    
display_blog_menu(7); }?>


<?php if (PAGE_ID != 8) { } else { 
    
display_blog_menu(8); }?>

The result is my first language display category and history with prefect, but the other 1 will have bug on the history it show the history is December 1969 and the post count # also count with the first language post too. is there any fix? or I did the wrong code
Title: Re: Display a Blog menu
Post by: spida on November 25, 2008, 08:18:07 PM
Hi,

so, you want to have the menu displayed only if the page id is checked and rendered correctly?

Is "PAGE_ID" the right reference? Is this as it is in the database?

Cheers,
spida
Title: Re: Display a Blog menu
Post by: Ruud on November 25, 2008, 11:12:54 PM
The result is my first language display category and history with prefect, but the other 1 will have bug on the history it show the history is December 1969 ....
December 1969 looks like an empty posted_when field. (where the data and time is stored)
Looking at the posts itself, do you see strange dates?
Try re-saving the posts on page_id 8. (it should set the posted_when date to today)
If you are using WB2.7, try display_blog_menu(8,1);. The ,1 tells this snippet to use the published_when date. This is the date you can enter in the backend to tell when an item may be shown.

Quote
and the post count # also count with the first language post too
I have no idea what you mean by this. Could you explain this better?

Ruud
Title: Re: Display a Blog menu
Post by: EinoLeino on January 23, 2009, 07:44:39 PM
How do i change archives month names to my own language?
Now there are all in english, and i want them to be in finnish
Title: Re: Display a Blog menu
Post by: gemnb on January 23, 2009, 11:31:26 PM
There are several possibilities, but you could do it like this:

Replace the following lines in include.php
Code: [Select]
           $output ="";
            //query to obtain history per month for the selected page
            $query = "SELECT MONTHNAME(FROM_UNIXTIME(".$date.")) as mo,MONTH(FROM_UNIXTIME(".$date.")) as m,FROM_UNIXTIME(".$date.",'%Y') as y,COUNT(*) as total FROM " .TABLE_PREFIX ."mod_news_posts WHERE page_id=$page_id AND active=true GROUP BY y,m ORDER BY y DESC,m DESC;";
            $result = $database->query($query);
            if($result->numRows() > 0){
                if ($history_header != "") {
                    echo $history_header;
                }
                while($history = $result->fetchRow()){
                    $output .= "<li><a href=\"" .WB_URL.PAGES_DIRECTORY .$page_link .PAGE_EXTENSION ."?y=".$history['y']."&m=".$history['m']."&method=".$date_option."\">" .$history['mo']." ".$history['y']."</a> (".$history['total'].")</li>\n";
                    }
                }
            $output = "<ul>".$output."</ul>";
            echo $output;

with

Code: [Select]
           $output ="";
            //query to obtain history per month for the selected page
            $query = "SELECT MONTHNAME(FROM_UNIXTIME(".$date.")) as mo,MONTH(FROM_UNIXTIME(".$date.")) as m,FROM_UNIXTIME(".$date.",'%Y') as y,COUNT(*) as total FROM " .TABLE_PREFIX ."mod_news_posts WHERE page_id=$page_id AND active=true GROUP BY y,m ORDER BY y DESC,m DESC;";
            $result = $database->query($query);
            if($result->numRows() > 0){
                if ($history_header != "") {
                    echo $history_header;
                }
                while($history = $result->fetchRow()){
                    if ($history['mo']=='January'){$history['mo']='January in you language';}
                    if ($history['mo']=='February'){$history['mo']='February in you language';}
                    if ($history['mo']=='March'){$history['mo']='March in you language';}
                                        // and so on...
                    $output .= "<li><a href=\"" .WB_URL.PAGES_DIRECTORY .$page_link .PAGE_EXTENSION ."?y=".$history['y']."&m=".$history['m']."&method=".$date_option."\">" .$history['mo']." ".$history['y']."</a> (".$history['total'].")</li>\n";
                    }
                }
            $output = "<ul>".$output."</ul>";
            echo $output;

Regards,
Ton
Title: Re: Display a Blog menu
Post by: Ruud on January 24, 2009, 12:08:45 AM
The simple way is to set the locale for the SQL server. (see http://dev.mysql.com/doc/refman/4.1/en/locale-support.html)

Just before the line:
Code: (include.php) [Select]
$query = "SELECT MONTHNAME(FROM_UNIXTIME(".$date.")) as mo,.....you add this line:
Code: [Select]
$database->query("SET lc_time_names = 'fi_FI';");
From that moment your month names should be in Finnish.

Ruud
Title: Re: Display a Blog menu
Post by: xoanon on January 24, 2009, 03:23:21 AM
There are several possibilities, but you could do it like this:

by AM. 24/1/09 -   also  included a suggestion for multilanguage sites that follow the 'pages/country-code' format i.e. 'pages/en' .... the following modification will work - I use English & Greek for my site
                   //
                     $uri = ($_SERVER['REQUEST_URI']);
                                 if ( stristr($uri, 'pages/contry_code')) {
                                                       if ($history['mo']=='January'){$history['mo']='January in you language';}
                                 }
note: ensure that you replace country_code with the correct definition


Replace the following lines in include.php
Code: [Select]
           $output ="";
            //query to obtain history per month for the selected page
            $query = "SELECT MONTHNAME(FROM_UNIXTIME(".$date.")) as mo,MONTH(FROM_UNIXTIME(".$date.")) as m,FROM_UNIXTIME(".$date.",'%Y') as y,COUNT(*) as total FROM " .TABLE_PREFIX ."mod_news_posts WHERE page_id=$page_id AND active=true GROUP BY y,m ORDER BY y DESC,m DESC;";
            $result = $database->query($query);
            if($result->numRows() > 0){
                if ($history_header != "") {
                    echo $history_header;
                }
                while($history = $result->fetchRow()){
                    $output .= "<li><a href=\"" .WB_URL.PAGES_DIRECTORY .$page_link .PAGE_EXTENSION ."?y=".$history['y']."&m=".$history['m']."&method=".$date_option."\">" .$history['mo']." ".$history['y']."</a> (".$history['total'].")</li>\n";
                    }
                }
            $output = "<ul>".$output."</ul>";
            echo $output;

with

Code: [Select]
           $output ="";
            //query to obtain history per month for the selected page
            $query = "SELECT MONTHNAME(FROM_UNIXTIME(".$date.")) as mo,MONTH(FROM_UNIXTIME(".$date.")) as m,FROM_UNIXTIME(".$date.",'%Y') as y,COUNT(*) as total FROM " .TABLE_PREFIX ."mod_news_posts WHERE page_id=$page_id AND active=true GROUP BY y,m ORDER BY y DESC,m DESC;";
            $result = $database->query($query);
            if($result->numRows() > 0){
                if ($history_header != "") {
                    echo $history_header;
                }
                while($history = $result->fetchRow()){
                   // for multilanguage sites that follow the 'pages/country-code' format i.e. 'pages/en'
                   // the following modification will work - I use English & Greek for my site
                   //
                     $uri = ($_SERVER['REQUEST_URI']);
                                 if ( stristr($uri, 'pages/country_code')) {
         
                    if ($history['mo']=='January'){$history['mo']='January in you language';}
                    if ($history['mo']=='February'){$history['mo']='February in you language';}
                    if ($history['mo']=='March'){$history['mo']='March in you language';}
                                        // and so on...
                                   }

                    $output .= "<li><a href=\"" .WB_URL.PAGES_DIRECTORY .$page_link .PAGE_EXTENSION ."?y=".$history['y']."&m=".$history['m']."&method=".$date_option."\">" .$history['mo']." ".$history['y']."</a> (".$history['total'].")</li>\n";
                    }
                }
            $output = "<ul>".$output."</ul>";
            echo $output;

Regards,
Ton
Title: Re: Display a Blog menu
Post by: EinoLeino on January 24, 2009, 11:24:30 AM
The simple way is to set the locale for the SQL server. (see http://dev.mysql.com/doc/refman/4.1/en/locale-support.html)

Just before the line:
Code: (include.php) [Select]
$query = "SELECT MONTHNAME(FROM_UNIXTIME(".$date.")) as mo,.....you add this line:
Code: [Select]
$database->query("SET lc_time_names = 'fi_FI';");
From that moment your month names should be in Finnish.

Ruud

Thanks man! That worked! So simple and easy way.
Title: Re: Display a Blog menu
Post by: abidan on April 13, 2009, 06:21:43 PM
Hi great mod!

I just have a small problem. I dont think my archiving menu works properly, you can see on www.buildmeafabwebs ite.co.uk, for some reason when i click on one of the months, either march or april it does not simply list that months posts? It correctly lists the numbers of posts for that month on the menu, but i assumed that when you clicked on the month it would also just return that months posts? Is this normal functionality, is it supposed to work like that i.e. list ALL posts or is it supposed to limit to that months posts when clicked? Have a i done something wrong?

Thanks in advance
Title: Re: Display a Blog menu
Post by: Ruud on April 13, 2009, 09:38:46 PM
Did you replace the view.php in your news module?

See this line in the README in the module zip file:
 
Quote
* replace view.php in the news module directory with the included news_view.php and rename it back to view.php
Changing that file should add the missing functionality to show pages per month.

Ruud
Title: Re: Display a Blog menu
Post by: abidan on April 14, 2009, 03:35:57 PM
Ruud, Dude, YOUR a Star thankyou i missed that line from instructions :) Cheers!
Title: Re: Display a Blog menu
Post by: sky writer on May 02, 2009, 05:24:07 PM
I love this module, and have had it up and working for some time now.  One thing I can't seem to figure out...
How can I change the order that the "Categories" (groups) are listed?
Right now it seems to list them by the group_id from database mod_news_groups.
I thought I could just change the database group "position" number for each group and that might do it.  But no luck.

Any help would be appreciated.
Title: Re: Display a Blog menu
Post by: sky writer on May 02, 2009, 06:07:13 PM
Not sure if this is the best/easiest way, but I did manage to get things ordered the way I wanted.

-go to your database (cPanel - myphpAdmin for me)
-Change the "position" numbers in mod_news_groups to the order you want.
-Click "Operations" (at top of page)
-Choose "position" "Ascending" in "Alter Table Order by"

Maybe this will help someone.

If there is a better way, I am still interested in hearing it.
Title: Re: Display a Blog menu
Post by: Ruud on May 02, 2009, 10:05:05 PM
There is a better way.

In the file /modules/blog_menu/include.php find the line below (line 46):

Code: [Select]
$query = "SELECT * FROM " .TABLE_PREFIX ."mod_news_groups WHERE page_id=$page_id AND active=true;";

add to that line ORDER BY `position` the way that is shown below:
Code: [Select]
$query = "SELECT * FROM " .TABLE_PREFIX ."mod_news_groups WHERE page_id=$page_id AND active=true ORDER BY `position`;";

Now the categories will be displayed in the same order as in the backend.

Ruud
Title: Re: Display a Blog menu
Post by: sky writer on May 03, 2009, 05:10:22 AM
Thank you!
Title: Re: Display a Blog menu
Post by: cyberdog on June 04, 2009, 01:24:30 AM
Hi all,

I have installed and tested the Blogmenu on a client's website while in development. All working fine. However the client requested the ability to include video footage so I thought IF POSSIBLE it would be a good idea to use the Mediablog module instead of the news module. this is because the MediaBlog module already has support for video.

Can anyone please point me to the right path to achieve this?

Many thanks!
Title: Re: Display a Blog menu
Post by: stumed on June 25, 2009, 09:01:26 PM
Hi everyone,

It's my first post here...in english, so i need some comprehensive due to my english writing...I try my best.

I need some help about the Blog menu. I read all the posts but something I missed for my specific needs.

The menu works fine but it display on all my page. I put the code in a div section on rideside column.
Here is the code;

<div id="myblog">
            <?php display_blog_menu(95,1,'<h2>Catégories</h2>','<h2>Archives</h2>',2);?>
            </div>
The "95" is my page_id but it appears on all my pages. I put the code on a "code page" but the menu appears in "the content page" and I don't want this. I just want that it appears in my right column like Eki website on his latest...latest post:-).

Another problems...I change the code in the include.php for the month can displaying in french.

I changed this code (submit by Ruud) for changing in finnish to french bot nothing work.
$database->query("SET lc_time_names = 'fr_FR';");

Can anyone give me some help please and excuse me again for my english writing.

Stumed
Title: Re: Display a Blog menu
Post by: mr-fan on June 26, 2009, 12:02:29 PM
Quote
The menu works fine but it display on all my page. I put the code in a div section on rideside column.
Here is the code;

<div id="myblog">
            <?php display_blog_menu(95,1,'<h2>Catégories</h2>','<h2>Archives</h2>',2);?>
            </div>
The "95" is my page_id but it appears on all my pages. I put the code on a "code page" but the menu appears in "the content page" and I don't want this. I just want that it appears in my right column like Eki website on his latest...latest post:-).

english isn't my fav -too ;)

i mean you don't want to display the menu on all pages! ? right!

-so just make a new block in your template (in the info.php see help docs multiple blocks...)

-put the call in a code section on the site you want show it & set the section to the block "right" for eg!

i've got a example in german on a site from me - there was a global block in the template that show a default section on every page with no special content and on the "news" page i show the blogmenu...
http://www.mr-vilsbiburg.de/pages/mr-infos.php (http://www.mr-vilsbiburg.de/pages/mr-infos.php)

regards from bavaria
martin
Title: Re: Display a Blog menu
Post by: stumed on June 26, 2009, 05:50:49 PM
@mr-fan

All in works fine with your great helpful. :-D
Thank you very much for your help, it's very very appreciate.

Stumed
Title: Re: Display a Blog menu
Post by: daydreamer on November 21, 2009, 01:15:07 PM
Does blog menu work with WB 2.8 Thanks
Title: Re: Display a Blog menu
Post by: stumed on November 23, 2009, 03:47:33 PM
@daydreamer

Hi, I dont try in the 2.8 version. It work well for me in 2.7. after some changes in the code(adding block for viewing in one page, not all)
I think that it's work in 2.8 but I'm not sure. I will testing it in some next weeks.

Cheers!

Stumed
Title: Re: Display a Blog menu
Post by: sky writer on November 23, 2009, 04:07:38 PM
I upgraded from 2.7-2.8 with the blog menu intact and no problems.
Title: Re: Display a Blog menu
Post by: daydreamer on November 27, 2009, 10:51:11 AM
In my posts it is showing [TEXT_POSTED_BY] [TEXT_ON] [PUBLISHED_DATE] like that why is this?
Title: Re: Display a Blog menu
Post by: Turskis on January 14, 2010, 02:20:15 PM
Same here. With WB 2.8 and replaced view.php in news module
Title: Re: Display a Blog menu
Post by: gucci on January 21, 2010, 11:42:01 AM
Hello all,

i want to use blog menu for my site, but I`ve seen that there are new versions of the view.php with some bugfix.


Replacing view.php in the news module directory means that you replace the bugfix.
Has someone made an adjustment?

Cheers gucci
Title: Re: Display a Blog menu
Post by: mr-fan on January 22, 2010, 12:10:28 AM
jea,

take the droplet ->blog menu....without replacing the view.php

https://forum.WebsiteBaker.org/index.php/topic,16331.msg107151.html#msg107151

regards martin
Title: Re: Display a Blog menu
Post by: gucci on January 22, 2010, 09:57:46 AM
cool,

thanks martin.

The droplet should be listet on AMASP.

Regards gucci
Title: Re: Display a Blog menu
Post by: sky writer on February 19, 2010, 10:38:56 PM
Maybe this will help others.

I did a code compare between the "Blog Menu" news/view.php and the News V3.5 view.php (installed with WB 2.8.1).  There was just a short bit of code to add over to allow it to function...

find:
Code: [Select]
// Check if we should only list posts from a certain group
if(isset($_GET['g']) AND is_numeric($_GET['g']))
    {
$query_extra = " AND group_id = '".$_GET['g']."'";
} else {
$query_extra = '';
}

// Get settings

Change to:

Code: [Select]
// Check if we should only list posts from a certain group
if(isset($_GET['g']) AND is_numeric($_GET['g']))
    {
$query_extra = " AND group_id = '".$_GET['g']."'";
} elseif(isset($_GET['m']) AND is_numeric($_GET['m']) AND isset($_GET['y']) AND is_numeric($_GET['y']) AND isset($_GET['method']) AND is_numeric($_GET['method'])){
$startdate = mktime(0,0,0,$_GET['m'],1,$_GET['y']);
$enddate = mktime(0,0,0,$_GET['m']+1,1,$_GET['y']);
switch($_GET['method']){
case 0:
$date_option = "posted_when";
break;
case 1:
$date_option = "published_when";
break;
}
$query_extra = " AND ".$date_option." >= '$startdate' AND ".$date_option." < '$enddate'";
} else {
$query_extra = '';
}

// Get settings
Title: Re: Display a Blog menu
Post by: sky writer on February 20, 2010, 03:36:23 AM
Guys,

The ?g=3?g=3 is not in the view.php but in the table settings in the backend of WB.
The breadcrumb links are being built from the original link. but when called from a "group link" it will include the group parameter too.

In the post header (settings button of newspage) the links are built using:
Code: [Select]
<td valign="top"><a href="[BACK]">[PAGE_TITLE]</a> >> <a href="[BACK]?g=[GROUP_ID]">[GROUP_TITLE]</a></td>
The [back] link will have the g= parameter (what is not right) and so the second level [back] will have two of them.

Change that line in:
Code: [Select]
<td valign="top"><a href="/pages/artikel.php">[PAGE_TITLE]</a> >> <a href="/pages/artikel.php?g=[GROUP_ID]">[GROUP_TITLE]</a></td>
And it is fixed.
Note: I used /pages/artikel.php in this example because that was in the "problem" page that spida reported. For other site, use whatever link is your news/blog page.

That will fix it.

Ruud


Ruud,

Thank you so much for this fix.  It works perfectly on the group link breadcrumbs.  Is there any way to make the "Back" link operate the same way when accessing post groupings of date specific links?  In other words, if someone clicks on June 2008 (2) and then clicks to view one of the two posts, then clicks the "Back" button, they are currently taken back to the root news posting page (with all posts listed).  Is there any way to take them back to the June 2008 News Posts page (with the two posts), that they came from?