To use this website completely, it is necessary to store cookies on your computer.
 

* Statistic

  • *Total Posts: 16399
  • *Total Topics: 2548
  • *Online Today: 10
  • *Most Online: 292
(2016 November 12, 09:37:31)
  • *Users: 0
  • *Guests: 0
  • *Spiders: 4
  • *Total: 4

  • *Yahoo!
  • *Google (2)
  • *Baidu

Blog feed block

Started by Atheos, 2009 December 17, 21:33:49

previous topic - next topic

0 Members and 0 Guests are viewing this topic.

feline

#15
2010 January 05, 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.

KB

#16
2010 January 06, 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!!

feline

#17
2010 January 06, 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.

KB

#18
2010 January 06, 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. 

[attachment deleted by admin]

feline

#19
2010 January 06, 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

[attachment deleted by admin]
Many are stubborn in relation to the path, a few in relation to the target.

KB

#20
2010 January 06, 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!

KB

#21
2010 January 07, 09:23:16
Works like a charm!! Thanks Again! 8)

kcmartz

#22
2010 January 27, 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

feline

#23
2010 January 27, 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.

ileami

#24
2010 February 13, 12:44:04
Hi all, I've tried to add this code on a SMF portal block
Quote from: feline ,  2009 December 21, 11:19:15
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

feline

#25
2010 February 13, 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.

ileami

#26
2010 February 13, 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..

ileami

#27
2010 February 13, 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

bluedevil

#28
2010 February 17, 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);
}

feline

#29
2010 February 17, 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.