-

Category show up within blog entries

Support for phpBB3, phpBB3 Modifications, and phpBB3 styles
Forum rules
Bugs go in the Bug Tracker

Category show up within blog entries

Postby Raziel_LOK » Sun Oct 02, 2011 10:20 am

After searching alot and triyng to put the categories o show inside each blog entry, without success. Most because i'm not familiar with php and SQL. So any tip that can help me to put the category of a blog entrie like the image attached will be appreciated. The category on the page is marked with a red line. Thank you.

Tags would do this job too, but I was not able to direct the correct function to return the category name of the blog_id entry. I barely can understand the functions structure of the "User Blog Mod" includes for now.
Attachments
Sem título.jpg
Raziel_LOK
Donor
Donor
 
Posts: 2
Joined: Sun Oct 02, 2011 12:52 am
Blog: View Blog (0)

Re: Category show up within blog entries

Postby EXreaction » Sun Oct 02, 2011 11:18 am

Doing that with the categories would be very difficult and would require a lot of php/sql knowledge, but it should not be too difficult with the tags.

It should only require some simple editing of this function in blog/plugins/tags/functions.php:
Code: Select all
function tags_blog_handle_data_end(&$args)
{
   global $user, $phpbb_root_path, $phpEx;

   $tags = array();
   foreach (get_tags_from_text(blog_data::$blog[$args['ID']]['blog_tags']) as $tag)
   {
      $tags[] = '<a href="' . append_sid("{$phpbb_root_path}blog.$phpEx", 'page=tag&amp;tag=' . $tag) . '">' . $tag . '</a>';
   }

   if (sizeof($tags))
   {
      $args['EXTRA'] .= '<br /><strong>' . $user->lang['TAGS'] . '</strong>: ' . implode(' &#8226; ', $tags);
   }
}


Below this line:
Code: Select all
$args['EXTRA'] .= '<br /><strong>' . $user->lang['TAGS'] . '</strong>: ' . implode(' &#8226; ', $tags);


Add this line:
Code: Select all
$args['TOP_TAG_LIST'] .= implode(' &#8226; ', $tags);


Then in the blog html body where the rest of the data is outputted, you should be able to use the TOP_TAG_LIST template variable to output the list wherever you want
Grateful for the mods I've built? Then donate!
User avatar
EXreaction
Site Owner
Site Owner
 
Posts: 4988
Joined: Wed Jun 28, 2006 5:08 pm
Blog: View Blog (53)

Re: Category show up within blog entries

Postby Raziel_LOK » Sun Oct 02, 2011 1:28 pm

Thank you it worked like a charm. You need to use {row.TOP_TAG_LIST} to work ont each blog entry.

Still need to make some changes on the main page, but here is the page I'm trying to work: http://fgs.net.br/fgsforum/blog

I really want to start working with PHP and SQL, I'm familiar with programming but web applications still blowing upmy mind. Any thoughts from where I should start?

Anyway thnk you for all the help.
Raziel_LOK
Donor
Donor
 
Posts: 2
Joined: Sun Oct 02, 2011 12:52 am
Blog: View Blog (0)

Re: Category show up within blog entries

Postby EXreaction » Sun Oct 02, 2011 4:16 pm

Glad that worked.

It may be good to borrow a book or two on PHP from a local library and go through them. That and just experimenting with code might be about the best way to learn. PHP is similar to compiled languages such as C and the many other languages based on C, so if you're familiar with that it shouldn't be too much to learn to get started at least.
Grateful for the mods I've built? Then donate!
User avatar
EXreaction
Site Owner
Site Owner
 
Posts: 4988
Joined: Wed Jun 28, 2006 5:08 pm
Blog: View Blog (53)


Return to phpBB3 Support



Who is online

Users browsing this forum: Bing [Bot], cvghjqr2, justc5q and 5 guests