Smarty Forum Index Smarty
WARNING: All discussion is moving to https://reddit.com/r/smarty, please go there! This forum will be closing soon.

Smarty Paginate

 
This forum is locked: you cannot post, reply to, or edit topics.   This topic is locked: you cannot edit posts or make replies.    Smarty Forum Index -> Language: German
View previous topic :: View next topic  
Author Message
avataroflive
Smarty Rookie


Joined: 03 Jul 2013
Posts: 6

PostPosted: Wed Jul 10, 2013 7:08 am    Post subject: Smarty Paginate Reply with quote

Hallo, leider bekomme ich das Smarty Paginate System bei mir einfach nicht zum laufen, hoffe jemand kennt sich damit etwas besser aus als ich.

Folgende Fehler tretten auf:

Warning: mysql_fetch_array() expects parameter 1 to be resource, boolean given in /var/www/vhosts/redxnet.de/site1/farbsys.php on line 18

Notice: SmartyPaginate setTotal: total must be an integer. in /var/www/vhosts/redxnet.de/site1/includes/libs/SmartyPaginate.class.php on line 131

Fatal error: Uncaught exception 'SmartyCompilerException' with message 'Syntax Error in template "./templates/farben.tpl" on line 68 "{paginate_prev} {paginate_middle} {paginate_next}" unknown tag "paginate_prev"' in /var/www/vhosts/redxnet.de/site1/includes/libs/sysplugins/smarty_internal_templatecompilerbase.php:665 Stack trace: #0 /var/www/vhosts/redxnet.de/site1/includes/libs/sysplugins/smarty_internal_templatecompilerbase.php(451): Smarty_Internal_TemplateCompilerBase->trigger_template_error('unknown tag "pa...', 6Cool #1 /var/www/vhosts/redxnet.de/site1/includes/libs/sysplugins/smarty_internal_templateparser.php(2393): Smarty_Internal_TemplateCompilerBase->compileTag('paginate_prev', Array) #2 /var/www/vhosts/redxnet.de/site1/includes/libs/sysplugins/smarty_internal_templateparser.php(3101): Smarty_Internal_Templateparser->yy_r37() #3 /var/www/vhosts/redxnet.de/site1/includes/libs/sysplugins/smarty_internal_templateparser.php(3201): Smarty_Internal_Templateparser->yy_reduce(37) #4 /var/w in /var/www/vhosts/redxnet.de/site1/includes/libs/sysplugins/smarty_internal_templatecompilerbase.php on line 665

Jetzt die 2 Codes dazu:
Code:
$ergebnis1 = sprintf("SELECT SQL_CALC_FOUND_ROWS * FROM api_Farben LIMIT %d,%d",SmartyPaginate::getCurrentIndex(), SmartyPaginate::getLimit());
$ergebnis = mysql_query($ergebnis1);
$farbarr = array();
while ($row = mysql_fetch_array($ergebnis)) {

// Auswahl der Namensprache
switch ($_SESSION['sprache']) {
    case de:
        $farben_name = $row['name_de'];
        break;
    case fr:
        $farben_name = $row['name_fr'];
        break;
    case es:
        $farben_name = $row['name_es'];
        break;
    case us:
        $farben_name = $row['name_us'];
        break;

       }
// Farbgebung Namen der Farben
switch ($row['seltenheit']) {
    case e:
        $seltenheit = '#2ECCFA';
        break;
    case m:
        $seltenheit = '#40FF00';
        break;
    case s:
        $seltenheit = '#D7DF01';
        break;
    case xs:
        $seltenheit = '#000000';
        break;
    case a:
        $seltenheit = '#A4A4A4';
        break;
       }


array_push($farbarr, array("seltenheit" => $seltenheit,
                     "farbname" => $farben_name,
                     "leicht" => RGBToHex($row['Rot_leicht'],$row['Grun_leicht'],$row['Blau_leicht']),
                     "leder" => RGBToHex($row['Rot_leather'],$row['Grun_leather'],$row['Blau_leather']),
                     "metal" => RGBToHex($row['Rot_metal'],$row['Grun_metal'],$row['Blau_metal'])));


}

$ergebnis1 = "SELECT FOUND_ROWS() as total";
        $ergebnis = mysql_query($ergebnis1);
        $row = mysql_fetch_array($ergebnis, MYSQL_ASSOC);

        SmartyPaginate::setTotal($_row['total']);


//print_r(array_values($farbarr));
$smarty->assign('farbwert',$farbarr);


tpl:
Code:
<div id="farbe_inhalt" style="overflow: auto; height: 400px;">

    <table class="reference notranslate">
       <tr>
    <th xstyle="background-color:white" width="25%">Name</th>
    <th xstyle="background-color:white" width="25%">Leicht</th>
    <th xstyle="background-color:white" width="25%">Mittel</th>
    <th xstyle="background-color:white" width="25%">Schwer</th>
  </tr>
    {foreach from=$farbwert item=wert key=k}
        {if $smarty.foreach.boxartikel.first}
            {$zahl = 1}
            <div id="{$zahl}">
                <tr>
                <td style="color: {$wert.seltenheit}  ">{$wert.farbname}</td>

                <td bgcolor="{$wert.leicht}">&nbsp;</td>

                <td bgcolor="{$wert.leder}">&nbsp;</td>

                <td bgcolor="{$wert.metal}">&nbsp;</td>
                </tr>
            </div>
    {elseif $smarty.foreach.boxartikel.iteration is even by 15}
        {$zahl = $zahl + 1}
            <div id="{$zahl}"></div>
                <tr>
                <td style="color: {$wert.seltenheit}  ">{$wert.farbname}</td>

                <td bgcolor="{$wert.leicht}">&nbsp;</td>

                <td bgcolor="{$wert.leder}">&nbsp;</td>

                <td bgcolor="{$wert.metal}">&nbsp;</td>
                </tr>
            </div>
    {/if}
    {if $smarty.foreach.boxartikel.last}
    {/if}

  </tr>
{/foreach}
   </table>
{* display pagination header *}
    Items {$paginate.first}-{$paginate.last} out of {$paginate.total} displayed.
     {* display results *}
    {section name=res loop=$results}
        {$results[res]}
    {/section}

    {* display pagination info *}
    {paginate_prev} {paginate_middle} {paginate_next}
        </div>

Danke schon einmal im Voraus
Back to top
View user's profile Send private message
Grizzly
Smarty Pro


Joined: 15 Apr 2011
Posts: 172
Location: Germany

PostPosted: Wed Jul 10, 2013 7:50 am    Post subject: Reply with quote

überprüfe mal ob evtl. magic_quotes_runtime auf ON steht in der php.ini (Servereinstellung), wenn ja, dann setz es mal auf OFF

Hast du bzw. benutzt du einen "output" Filter?

Hast du bei dir im smarty html_escape auf true gesetzt?
Back to top
View user's profile Send private message Visit poster's website
Fahrstuhllicht
Smarty Rookie


Joined: 10 Jun 2013
Posts: 15
Location: Berlin

PostPosted: Wed Jul 10, 2013 5:42 pm    Post subject: Reply with quote

Versuch doch einfach mal zum testen, ne einfache Selectabfrage.

Oder mach doch mal nen var_dump von $ergebnis 1 und $ergebnis, weil die Fehlermeldung sagt ja aus, dass er eine Resource will, aber boolean gegeben ist.
Back to top
View user's profile Send private message Send e-mail
Grizzly
Smarty Pro


Joined: 15 Apr 2011
Posts: 172
Location: Germany

PostPosted: Thu Jul 11, 2013 7:08 am    Post subject: Reply with quote

Stimmt, ich habe diese ersten zwei Meldungen von oben gar nicht gesehen...

Ich denke dass diese Zeile probleme macht:



Code:
sprintf("SELECT SQL_CALC_FOUND_ROWS * FROM api_Farben LIMIT %d,%d",SmartyPaginate::getCurrentIndex(), SmartyPaginate::getLimit());


Kann es sein, dass SmartyPaginate::getCurrentIndex() oder SmartyPaginate::getLimit() etwas falsches liefert? Probier doch mal statt den beiden Methodenaufruf lieber sowas wie:

Code:
sprintf("SELECT SQL_CALC_FOUND_ROWS * FROM api_Farben LIMIT %d,%d", 0, 10);
Back to top
View user's profile Send private message Visit poster's website
avataroflive
Smarty Rookie


Joined: 03 Jul 2013
Posts: 6

PostPosted: Thu Jul 11, 2013 7:32 am    Post subject: Reply with quote

also es läuft jetzt war die ein oder andere kleinigkeit, größtes problem war das es bei meinem smarty 2 plugin order gibt habs jetzt in beiden und es läuft soweit, danke nochmal
Back to top
View user's profile Send private message
Display posts from previous:   
This forum is locked: you cannot post, reply to, or edit topics.   This topic is locked: you cannot edit posts or make replies.    Smarty Forum Index -> Language: German All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB © 2001, 2005 phpBB Group
Protected by Anti-Spam ACP