* User

Welcome, Guest. Please login or register.
Did you miss your activation email?

18 Mar 10, 13:15:42

Login with username, password and session length

Select language:

* Recent Topics



Donate

Donate for PortaMx !
Your donation is safe and helps support the issues and causes you care most about.

* Stats


  • *Total Posts: 9192
  • *Total Topics: 1337
  • *Online Today: 22
  • *Most Online: 157
(27 Aug 09, 03:54:53)
  • *Users: 1
  • *Guests: 11
  • *Spiders: 0
  • *Total: 12

* Themes

*

Author Topic: Blog feed block  (Read 1891 times)

0 Members and 1 Guest are viewing this topic.

Offline feline

  • CO PortaMx corp.
  • Administrator
  • *
  • Posts: 2822
  • Gender: Female
Re: Blog feed block
« Reply #15 on: 05 Jan 10, 21:42:30 »
you can try this PmxBlogSSI function ...

/**
* PmxBlogSSI_ShowArticles()
* owner: integer ownerID or ownerName
* mindate: integer unixdate OR string 'mon.day.year' (0 not used)
*            string date: mon{1-12}, day{1-31}, year{4 digit})
* maxdate: integer unixdate OR string 'mon.day.year' (0 not used)
*            string date: mon{1-12}, day{1-31}, year{4 digit})
* categorie: id or name (0 not used)
* maxlen: integer max articles to show (0 = all)
* output: 'echo' or empty
**/

Fel
Many are stubborn in relation to the path, a few in relation to the target.

Offline KB

  • Newbie
  • *
  • Posts: 11
Re: Blog feed block
« Reply #16 on: 06 Jan 10, 00:18:21 »
Thanks Fel..but you seem to forget that Im php challenged.. ;)
I tried to use cools example for a side block and modified the code as follows, but of course, got a syntax error, so I know Ive left something important out..doh!
Code: [Select]
include_once('PmxBlogSSI.php');
PmxBlogSSI_ShowArticles(owner:2);
Id like to have both the simple side block (as cool mentioned) and also the frontpage or center block example that you provided earlier....only of course with the single user format. 
thx again!!

Offline feline

  • CO PortaMx corp.
  • Administrator
  • *
  • Posts: 2822
  • Gender: Female
Re: Blog feed block
« Reply #17 on: 06 Jan 10, 00:41:19 »
the call must defines as PmxBlogSSI_ShowArticles(2); where 2 is the owner ID.

Also you can take a look at the sample files you found in your forum root  ;)

Fel
Many are stubborn in relation to the path, a few in relation to the target.

Offline KB

  • Newbie
  • *
  • Posts: 11
Re: Blog feed block
« Reply #18 on: 06 Jan 10, 06:51:36 »
Great!!  Thanks Fel...that works better,
Code: [Select]
include_once('PmxBlogSSI.php');
PmxBlogSSI_ShowArticles(2);
but displays too much for a side block.(see attached pmx_blog_sideblock2.jpg)  I was hoping that by using cools' example as a starting point (because it only displays title, author, date/time as in attached pmx_blog_sideblock1.jpg) that it would work similarly to the way his original code does (less info, trunicated or no content, without calendar or categories) ,  sorry I did look into the samples again, but Im just not sure what code to use in order to make it work. 

Offline feline

  • CO PortaMx corp.
  • Administrator
  • *
  • Posts: 2822
  • Gender: Female
Re: Blog feed block
« Reply #19 on: 06 Jan 10, 13:45:51 »
I have modified the recent Function, to get only recent blogs from a specific user.
Copy the attached PmxBlog.SSI.php to your server (overwrite the exist file).
Then make a php Block with follow content
Code: [Select]
include_once('PmxBlogSSI.php');
PmxBlogSSI_Recent(5, 1);
where 5 is the number of recent articles and 1 is the userid which blogs you will see.
Of course you have to set this to your values  ;)

Fel
Many are stubborn in relation to the path, a few in relation to the target.

Offline KB

  • Newbie
  • *
  • Posts: 11
Re: Blog feed block
« Reply #20 on: 06 Jan 10, 20:58:11 »
Thanks So much Fel...I really appreciate the support you have provided for me and see the same effort being given to each and every person who asks...that says a lot for you and for portamx.   O0
Ill give this a shot and let ya know how it goes, but Im sure its exactly what the doc ordered..lol..THANKS AGAIN!

Offline KB

  • Newbie
  • *
  • Posts: 11
Re: Blog feed block
« Reply #21 on: 07 Jan 10, 09:23:16 »
Works like a charm!! Thanks Again! 8)

Offline kcmartz

  • Owner/Kcmartz.com
  • Newbie
  • *
  • Posts: 29
  • Gender: Male
  • Hello all!
    • Kcmartz's Site
Re: Blog feed block
« Reply #22 on: 27 Jan 10, 21:18:44 »
Code: [Select]
include_once('PmxBlogSSI.php');
PmxBlogSSI_Recent(5, 1);

I would like it to show for a certain few members, is this the correct syntax?:
Code: [Select]
include_once('PmxBlogSSI.php');
PmxBlogSSI_Recent(5, 1,2,3);

Thanks!
If not, what does it look like to make it from a certain few members that I select?
Thanks,
Kcmartz

Offline feline

  • CO PortaMx corp.
  • Administrator
  • *
  • Posts: 2822
  • Gender: Female
Re: Blog feed block
« Reply #23 on: 27 Jan 10, 23:38:59 »
That don't work. Recent blogs is the same as recent post, it show the last posted blogs.
With the change they I have posted you can see the recent for ONE member, but not for a list of member.

Fel
Many are stubborn in relation to the path, a few in relation to the target.

Offline ileami

  • Newbie
  • *
  • Posts: 3
  • Gender: Female
Re: Blog feed block
« Reply #24 on: 13 Feb 10, 12:44:04 »
Hi all, I've tried to add this code on a SMF portal block
Yes, try this ..
Code: [Select]
include_once('PmxBlogSSI.php');
global $context, $smcFunc, $user_info, $txt;

$maxarticles = 5; // max articles to show
$context['PmxBlog']['content_len'] = 40; // Teaser length

if(AllowedToBlog('view'))
{
$result = array();
$req = $smcFunc['db_query']('', '
SELECT c.ID, c.subject
FROM {db_prefix}pmxblog_content AS c
LEFT JOIN {db_prefix}members AS m ON (c.owner = m.id_member)
LEFT JOIN {db_prefix}pmxblog_manager AS a ON (c.owner = a.owner)
WHERE a.blogenabled > 0 AND a.bloglocked = 0 AND c.published = 1
AND (c.allow_view = 0
OR (c.allow_view = 1 AND {int:idmem} > 0)
OR (c.allow_view = 2 AND {string:s_idmem} IN (m.buddy_list))
OR (c.allow_view = 3 AND c.owner = {int:idmem})
OR (c.owner = {int:idmem}))
GROUP BY c.ID
ORDER BY c.date_created DESC
LIMIT {int:lim}',
array(
's_idmem' => (string) $user_info['id'],
'idmem' => $user_info['id'],
'lim' => $maxarticles,
)
);
if($smcFunc['db_num_rows']($req) > 0)
{
$i = 0;
while($row = $smcFunc['db_fetch_assoc']($req))
{
$result[$i] = array('id' => $row['ID'], 'subject' => $row['subject']);
$i++;
}
$smcFunc['db_free_result']($req);
}

// link requested?
if(isset($_REQUEST['blogcont']))
$artid = (int) $_REQUEST['blogcont'];
elseif(!empty($result))
$artid = $result[0]['id'];
else
{
echo '
'. $txt['PmxBlog_nothing_read'];
return;
}

// get the selected article data
$article = PmxBlogSSI_GetArticle($artid, '');
$article['body'] = Post_Teaser($article['body']); // call the teaser
PmxBlogArticles_SSI_Out($article, $result, $artid);
}

Fel
but I got db error..
any help/suggestion?
Thanks
Lia

Offline feline

  • CO PortaMx corp.
  • Administrator
  • *
  • Posts: 2822
  • Gender: Female
Re: Blog feed block
« Reply #25 on: 13 Feb 10, 12:50:49 »
What says the error log? More specific error?

Fel
Many are stubborn in relation to the path, a few in relation to the target.

Offline ileami

  • Newbie
  • *
  • Posts: 3
  • Gender: Female
Re: Blog feed block
« Reply #26 on: 13 Feb 10, 12:57:26 »
just i get this "Database error in block code. Please check the code."  :-\
but in block preview it seems to work fine..

Offline ileami

  • Newbie
  • *
  • Posts: 3
  • Gender: Female
Re: Blog feed block
« Reply #27 on: 13 Feb 10, 14:11:38 »
Solved ... I turned off PHP validation in SMF Portal config ...  ;D
now the block work fine ...
 thanks to Feline for your support  O0

Offline bluedevil

  • Newbie
  • *
  • Posts: 15
  • Gender: Male
    • ChevyAvalancheClub
Re: Blog feed block
« Reply #28 on: 17 Feb 10, 17:23:18 »
Fel,

I like this block code you posted.  Could you make it work to post only blogs from a certain member only, certain categories, show the "comment" link and show avatar?

Code: [Select]
include_once('PmxBlogSSI.php');
global $context, $smcFunc, $user_info, $txt;

$maxarticles = 5;   // max articles to show
$context['PmxBlog']['content_len'] = 40;      // Teaser length

if(AllowedToBlog('view'))
{
   $result = array();
   $req = $smcFunc['db_query']('', '
      SELECT c.ID, c.subject
      FROM {db_prefix}pmxblog_content AS c
      LEFT JOIN {db_prefix}members AS m ON (c.owner = m.id_member)
      LEFT JOIN {db_prefix}pmxblog_manager AS a ON (c.owner = a.owner)
      WHERE a.blogenabled > 0 AND a.bloglocked = 0 AND c.published = 1
         AND (c.allow_view = 0
         OR (c.allow_view = 1 AND {int:idmem} > 0)
         OR (c.allow_view = 2 AND {string:s_idmem} IN (m.buddy_list))
         OR (c.allow_view = 3 AND c.owner = {int:idmem})
         OR (c.owner = {int:idmem}))
      GROUP BY c.ID
      ORDER BY c.date_created DESC
      LIMIT {int:lim}',
      array(
         's_idmem' => (string) $user_info['id'],
         'idmem' => $user_info['id'],
         'lim' => $maxarticles,
      )
   );
   if($smcFunc['db_num_rows']($req) > 0)
   {
      $i = 0;
      while($row = $smcFunc['db_fetch_assoc']($req))
      {
         $result[$i] = array('id' => $row['ID'], 'subject' => $row['subject']);
         $i++;
      }
      $smcFunc['db_free_result']($req);
   }

   // link requested?
   if(isset($_REQUEST['blogcont']))
      $artid = (int) $_REQUEST['blogcont'];
   elseif(!empty($result))
      $artid = $result[0]['id'];
   else
   {
      echo '
      '. $txt['PmxBlog_nothing_read'];
      return;
   }

   // get the selected article data
   $article = PmxBlogSSI_GetArticle($artid, '');
   $article['body'] = Post_Teaser($article['body']);   // call the teaser
   PmxBlogArticles_SSI_Out($article, $result, $artid);
}

Offline feline

  • CO PortaMx corp.
  • Administrator
  • *
  • Posts: 2822
  • Gender: Female
Re: Blog feed block
« Reply #29 on: 17 Feb 10, 22:00:49 »
I  can't make more as I posted and whats the PmxBlogSSI do .. and what you want is't possible.

Fel
Many are stubborn in relation to the path, a few in relation to the target.