looking for a way to fetch most poular posts and most recent posts

Started by glennmckenna, October 03, 2015, 10:32:33 AM

Previous topic - Next topic

glennmckenna

may i ask were could i find the link to the profil image in the database ?

would it be possible to do it by just using php ?

Arantor

There's several different possible URLs depending on user choice and your configuration, it really isn't particularly simple to just do.

Kindred

And to your question on php...  You would HAVE to pull the data from the database, since it is not loaded into the php arrays for the code that you already have,.
Слaва
Украинi

Please do not PM, IM or Email me with support questions.  You will get better and faster responses in the support boards.  Thank you.

"Loki is not evil, although he is certainly not a force for good. Loki is... complicated."

glennmckenna

i seem to be getting a problem , when ever i run this part of the code:

$pop = ssi_topTopics(NULL, NULL,'array');
i get this error :
The database value you're trying to insert does not exist: limit
i assume that it's somthing i'm doing wrong with the arguments ?

here is a copy of the code for the page:
<?php
require_once('scripts/SSI-link.php');

$context['page_title_html_safe'] = '';
if (empty(
$context['html_headers']))
    
$context['html_headers'] = '';


template_header();
//votre code vas ici sous format html
echo '
<div id="carousel-example-generic" class="carousel slide" data-ride="carousel">
  <!-- Indicators -->
  <ol class="carousel-indicators">
    <li data-target="#carousel-example-generic" data-slide-to="0" class="active"></li>
    <li data-target="#carousel-example-generic" data-slide-to="1"></li>
    <li data-target="#carousel-example-generic" data-slide-to="2"></li>
  </ol>

  <!-- Wrapper for slides -->
  <div class="carousel-inner" role="listbox">
    <div class="item active">
      <img src="images/placeholder-image-wide.png" alt="...">
      <div class="carousel-caption">
        ...
      </div>
    </div>
    <div class="item">
      <img src="images/placeholder-image-wide.png" alt="...">
      <div class="carousel-caption">
        ...
      </div>
    </div>
  </div>

  <!-- Controls -->
  <a class="left carousel-control" href="#carousel-example-generic" role="button" data-slide="prev">
    <span class="glyphicon glyphicon-chevron-left" aria-hidden="true"></span>
    <span class="sr-only">Previous</span>
  </a>
  <a class="right carousel-control" href="#carousel-example-generic" role="button" data-slide="next">
    <span class="glyphicon glyphicon-chevron-right" aria-hidden="true"></span>
    <span class="sr-only">Next</span>
  </a>
</div>



<div class="col-md-6 col-xs-12">
    <a class="twitter-timeline" href="https://twitter.com/MDLPalissy" data-widget-id="706827167091576833" width="100%">Tweets de @MDLPalissy</a>
      <script>
!function(d,s,id){var js,fjs=d.getElementsByTagName(s)[0];if(!d.getElementById(id)){js=d.createElement(s);js.id=id;js.src="//platform.twitter.com/widgets.js";fjs.parentNode.insertBefore(js,fjs);}}(document,"script","twitter-wjs");</script>
</div>'
;
//ssi_topTopics();
$rec ssi_recentTopics(10NULLNULL,'array');
$pop ssi_topTopicsViews(NULLNULL,'array');
echo 
'
<div class="col-md-6 col-xs-12">
    <table class="table_list">
        <tbody class="header">
            <tr>
                <td colspan="4">
                    <div class="cat_bar">
                        <h3 class="catbg">
                           '
,$txt['recent_posts'],'
                        </h3>
                    </div>
                </td>
            </tr>
        </tbody>
        <tbody class="header">
            <tr>
                <td colspan="4">
                    <div class="cat_bar">
                        <h3 class="catbg">
                           '
,$txt['recent_posts'],'
                        </h3>
                    </div>
                </td>
            </tr>
        </tbody>    
        <tbody class="content">
            <tr class="windowbg4">
    '
;
                    foreach (
$rec as $recent)
                    {
                        echo 
'
                         <tr class="windowbg4">
                            <td class="icon" style="height:40px;"> 
                                
                            </td>
                            <td class="info">'
;
                                echo 
'
                                <a class="subject" href="'
$recent['board']['href'], '">'$recent['board']['name'], '</a>';
                                echo
'
                                <p><a href="'
$recent['href'], '">'$recent['link'],'</a> '$txt['by'];
                                echo
'
                                <a href="'
$recent['poster']['href'],'">'$recent['poster']['name'],'</a> </p>
                            </td>
                            <td class="date">
                                <p>'
,$recent['time'],'</p>
                            </td>
                            <td class="icon lastpost-1">
                                <a href="'
$recent['href'], '"><img src="'$settings['images_url'], '/'$context['theme_variant_url'], '/icons/last_post.gif" alt="'$txt['latest_post'], '" title="'$txt['latest_post'], '" /></a>
                            </td>
                         </tr>'
;
                    }

                    echo 
'
                
            </tr>
        </tbody>

        <tbody class="divider">
            <tr>
                <td colspan="4"></td>
            </tr>
        </tbody>

         <tbody class="divider">
            <tr>
                <td colspan="4"></td>
            </tr>
        </tbody>
    </table>
    <table class="table_list">
        <tbody class="header">
            <tr>
                <td colspan="5">
                    <div class="cat_bar">
                        <h3 class="catbg">
                           '
,$txt['recent_posts'],'
                        </h3>
                    </div>
                </td>
            </tr>
        </tbody>    
        <tbody class="content">
            <tr class="windowbg4">
    '
;


                    echo 
'
            </tr>
        </tbody>
        <tbody class="divider">
            <tr>
                <td colspan="4"></td>
            </tr>
        </tbody>
    </table>
    </div>'
;

template_footer() ;
?>


glennmckenna

right i've fixed the problem
here's the fixed code
<?php
require_once('scripts/SSI-link.php');

$context['page_title_html_safe'] = '';
if (empty(
$context['html_headers']))
    
$context['html_headers'] = '';


template_header();
//votre code vas ici sous format html
echo '
<div id="carousel-example-generic" class="carousel slide" data-ride="carousel">
  <!-- Indicators -->
  <ol class="carousel-indicators">
    <li data-target="#carousel-example-generic" data-slide-to="0" class="active"></li>
    <li data-target="#carousel-example-generic" data-slide-to="1"></li>
    <li data-target="#carousel-example-generic" data-slide-to="2"></li>
  </ol>

  <!-- Wrapper for slides -->
  <div class="carousel-inner" role="listbox">
    <div class="item active">
      <img src="images/placeholder-image-wide.png" alt="...">
      <div class="carousel-caption">
        ...
      </div>
    </div>
    <div class="item">
      <img src="images/placeholder-image-wide.png" alt="...">
      <div class="carousel-caption">
        ...
      </div>
    </div>
  </div>

  <!-- Controls -->
  <a class="left carousel-control" href="#carousel-example-generic" role="button" data-slide="prev">
    <span class="glyphicon glyphicon-chevron-left" aria-hidden="true"></span>
    <span class="sr-only">Previous</span>
  </a>
  <a class="right carousel-control" href="#carousel-example-generic" role="button" data-slide="next">
    <span class="glyphicon glyphicon-chevron-right" aria-hidden="true"></span>
    <span class="sr-only">Next</span>
  </a>
</div>



<div class="col-md-6 col-xs-12">
    <a class="twitter-timeline" href="https://twitter.com/MDLPalissy" data-widget-id="706827167091576833" width="100%">Tweets de @MDLPalissy</a>
      <script>
!function(d,s,id){var js,fjs=d.getElementsByTagName(s)[0];if(!d.getElementById(id)){js=d.createElement(s);js.id=id;js.src="//platform.twitter.com/widgets.js";fjs.parentNode.insertBefore(js,fjs);}}(document,"script","twitter-wjs");</script>
</div>'
;
$rec ssi_recentTopics(10NULLNULL,'array');
$pop ssi_topTopicsReplies(10'array');
echo 
'
<div class="col-md-6 col-xs-12">
    <table class="table_list">
        <tbody class="header">
            <tr>
                <td colspan="4">
                    <div class="cat_bar">
                        <h3 class="catbg">
                           '
,$txt['recent_posts'],'
                        </h3>
                    </div>
                </td>
            </tr>
        </tbody>    
        <tbody class="content">
            <tr class="windowbg4">
    '
;
                    foreach (
$rec as $recent)
                    {
                        echo 
'
                         <tr class="windowbg4">
                            <td class="icon" style="height:40px;"> 
                                
                            </td>
                            <td class="info">'
;
                                echo 
'
                                <a class="subject" href="'
$recent['board']['href'], '">'$recent['board']['name'], '</a>';
                                echo
'
                                <p><a href="'
$recent['href'], '">'$recent['link'],'</a> '$txt['by'];
                                echo
'
                                <a href="'
$recent['poster']['href'],'">'$recent['poster']['name'],'</a> </p>
                            </td>
                            <td class="date">
                                <p>'
,$recent['time'],'</p>
                            </td>
                            <td class="icon lastpost-1">
                                <a href="'
$recent['href'], '"><img src="'$settings['images_url'], '/'$context['theme_variant_url'], '/icons/last_post.gif" alt="'$txt['latest_post'], '" title="'$txt['latest_post'], '" /></a>
                            </td>
                         </tr>'
;
                    }

                    echo 
'
                
            </tr>
        </tbody>

        <tbody class="divider">
            <tr>
                <td colspan="4"></td>
            </tr>
        </tbody>

         <tbody class="divider">
            <tr>
                <td colspan="4"></td>
            </tr>
        </tbody>
    </table>
    <table class="table_list">
        <tbody class="header">
            <tr>
                <td colspan="5">
                    <div class="cat_bar">
                        <h3 class="catbg">
                           '
,$txt['recent_posts'],'
                        </h3>
                    </div>
                </td>
            </tr>
        </tbody>    
        <tbody class="content">
            <tr class="windowbg4">
    '
;
foreach (
$pop as $popu)
{
echo 
'
                         <tr class="windowbg4">
                            <td class="icon" style="height:40px;"> 
                                
                            </td>
                            <td class="info">
                                <a class="subject" href="'
$popu['href'],'">'$popu['subject'], '</a>
                            </td>
                            <td class="date">
                                <p>'
,$popu['num_views'],'</p>
                            </td>
                            <td class="date">
                                <p>'
,$popu['num_replies'],'</p>
                            </td>
                            <td class="icon lastpost-1">
                                <a href="'
$popu['href'], '"><img src="'$settings['images_url'], '/'$context['theme_variant_url'], '/icons/last_post.gif" alt="'$txt['latest_post'], '" title="'$txt['latest_post'], '" /></a>
                            </td>
                         </tr>'
;
}
                    echo 
'
            </tr>
        </tbody>
        <tbody class="divider">
            <tr>
                <td colspan="4"></td>
            </tr>
        </tbody>
    </table>
    </div>'
;

template_footer() ;
?>


Advertisement: