Jump to content
WebFlake
  • 0

Other Articles By Author Help


Stokley

Question

I have a developer that I hired to help me with my site but he can't figure out a couple things. I wanted 2 blocks, 1 that would pull the recent articles by the current article author and display them under the current article being viewed or on the sidebar. He said it's not possible with the side bar but I've seen it, I just can't find out how to do it.

 

This is the block he made for the "Other Article's By Author" block but it just pulls all the recent articles, not just the ones from the author.

<div class='general_box'>
    <h3>{$title}</h3>
    <ul class='hfeed'>
        <if test="is_array( $records ) && count( $records )">
        {parse striping="feed_striping" classes="row1,row2 altrow"}
        <foreach loop="$records as $r">
        <li class='hentry {parse striping="feed_striping"}'><a href='{$r['url']}' rel='bookmark' title='{$r['title']}'>{$r['title']}</a>
            <br /><span class='date'><abbr class="published" title="{parse expression="date( 'c', $r['date'] )"}">{parse date="$r['date']" format="short"}</abbr></span>
            <span class='desctext'>{IPSText::truncate( strip_tags($r['content']), 32 )}</span>
        </li>
        </foreach>
        </if>
    </ul>
</div>
<br /> 

The second block I wanted that he says he can't figure out how to do is a block that will show other articles with the same topic. If I have 2 articles in Health Care and 3 in Personal Care, I would like it to suggest other articles with the same tags or even categories. I have that feature on the board but he can't figure out how to get it to show for article tags or categories.  Any help would be appreciated. I posted this on the main IPB forums but no help so far, I thought I'd ask here. 

Link to comment
Share on other sites

11 answers to this question

Recommended Posts

  • 0

It means he has no php experience at all.

 

Here is his while.

<if test="is_array( $records ) && count( $records )">
<div class='ipsSideBlock clearfix' id='recent_articles'>
    <h3>{$title}</h3>
    <ul class='block_list'>
        <foreach loop="$records as $r">
    <php>$likeRecs = array();
	ipsRegistry::DB()->build(array('select'	=> 'field_1 as title, field_3 as content, record_updated as date, record_dynamic_url as url',
        'from' => 'ccs_custom_database_1',
       'where' => 'member_id='.$r['member_id'].' and post_key != "'.$r['post_key'].'"'));
	$rnew = ipsRegistry::DB()->execute();
        while( $rlikes = ipsRegistry::DB()->fetch($rnew) )
// Below is the while he wants
{  
// whatever he wants goes in here
 }
// Above is the while he wants
    </php> 
            <li>
	        <a href='{$r['url']}'>{parse expression="IPSText::truncate( $r['field_1_value'], 30 )"}</a>
	    </li>
        </foreach>
    </ul>
</div>
<br />
</if>
  • Upvote 1
  • Downvote 1
Link to comment
Share on other sites

  • 0

The code you supplied only processes records. Where is the code to pull the records. That code needs to add to the where sql statement to check for the starter_id.

 

The second would have to add to the where to check the forum_id of the topic then find it's parent (category) and all the forums under that category. Then add to the sql where to check if the forum_id is one of the forums in that category. 

Link to comment
Share on other sites

  • 0

Lock Down, thanks for the reply but I tried to explain to the guy working for me on this site and he said there isn't  a way to pull the member ID? I know that is incorrect as I have seen it done. Is there a code example of something like this I can show him where it is pulling the Member_ID of who posted the article? Thanks again for the help. 

Link to comment
Share on other sites

  • 0

Ok here is the code to get the like articles by the same author. I just have it display the count of the like articles. I hope th "code" can get at least the information he needs from it..

<if test="is_array( $records ) && count( $records )">
<div class='ipsSideBlock clearfix' id='recent_articles'>
    <h3>{$title}</h3>
    <ul class='block_list'>
        <foreach loop="$records as $r">
    <php>$likeRecs = array();
	ipsRegistry::DB()->build(array('select'	=> '*','from' => 'ccs_custom_database_1',
       'where' => 'member_id='.$r['member_id'].' and post_key != "'.$r['post_key'].'"'));
	$rnew = ipsRegistry::DB()->execute();
        while( $rlikes = ipsRegistry::DB()->fetch($rnew) ){  $likeRecs[] = $rlikes; }
    </php> ** {parse expression="count($likeRecs)"}**
            <li>
	        <a href='{$r['url']}'>{parse expression="IPSText::truncate( $r['field_1_value'], 30 )"}</a>
	    </li>
        </foreach>
    </ul>
</div>
<br />
</if>
  • Upvote 1
Link to comment
Share on other sites

  • 0

Thank you so much. I've never had to rely on asking so many questions for things that seem like they should be easy to do before. I really do appreciate the help and apologize for my horrible noob questions. I feel I was greatly mislead by IPB about IP Conent and it's ease of use. It's easy if you know HTML, CSS and php I hear but I'm not strong in all of those. The guy working with me is knowledgeable in these areas, I've worked on other things with him before and he's still struggling,so, again thank you.

Link to comment
Share on other sites

  • 0

Ok so he tried the code and he said he can not figure out how to get it to pull theinformation to populate the "Other Articles by Author" field. When I asked what he needed help with this is his response:

 

 

 

just write that how to use *while loop* for fetch table row according to where clause

 

I have no clue what that means. 

Link to comment
Share on other sites

Guest
This topic is now closed to further replies.
×
×
  • Create New...