PHWinfo banniere

Titres
PORTAIL ANNUAIRE ARTICLES COMPARATEUR HÉBERGEURS DEVIS FORUMS RÉDUCTEUR D'URL
Précédent   PHWinfo > Autres forums > Forum Programmation & Conception > php.smarty.general > example not working...
S'inscrire FAQ Membres Recherche Messages du jour Marquer les forums comme lus
example not working...

Réponse
 
LinkBack Outils de la discussion
Vieux 04/10/2006, 00h39   #1
Michael Kolakowski
Aucun Avatar
 
Messages: n/a
Hébergeur:
Par défaut example not working...

Hi,

I cannot seem to get the third table in this example to work:

http://smarty.php.net/manual/en/lang...html.table.php

I am using the latest smarty and php5 on a Mac. The problem is the cols
attribute. I typed it in exactly like the example and I get a divide by
zero error. I also tried declaring an array, with the col names, in my
php file. Then I tired using the array as such in my template file:

{html_table loop=$tableData cols=$colNames tr_attr=$colors}

At which point the table finally showed up, BUT there was only one
column...and none of the column names were there. The alternating
colors worked, however.

Thanks,
Michael Kolakowski
  Réponse avec citation
Vieux 10/10/2006, 17h47   #2
Michael Kolakowski
Aucun Avatar
 
Messages: n/a
Hébergeur:
Par défaut Re: [SMARTY] example not working...

Thanks for the , Ken. However, I now have a couple new questions.

First: There is a th_attr attribute listed for html_table (link
below). I cannot get it to work. I tried using a string and assigning
an array in the php file to be passed to the template. Neither worked.

Second: I also tried, on a whim, to use the caption attribute. It
seems fairly simple, but again, it does not work. My line looks like this:

{html_table loop=$tableData cols=2 caption="hello"
table_attr='border="2"' tr_attr=$colors}

For what it's worth, I am getting a bit frustrated with html_table as
things do not seem to be working as advertised. I would either
appreciate corrections to the documentation or more examples showing how
things work - e.g. and example using *all* the attributes for whatever
function it is.

Note: I am aware this is open source and many work very hard and
volunteer. I fully respect that. I am not trying to be mean, just
trying to give some feedback from a new user's point of view. That is
important if you want people to adopt your product. By the way - I do
like Smarty so far...very cool indeed.

Thank you much,
Michael Kolakowski



Ken Snyder wrote:
> It appears that the documentation is incorrect. Using version 2.6.14,
> the cols parameter is only used as an integer. It has no
> functionality to pass in column names or do <th> at all. You might
> try a custom plugin from one of the plugin repositories.
>
> Ken
>
> From plugins/function.html_table.php
>
> $loop_count = count($loop);
> if (empty($params['rows'])) {
> /* no rows specified */
> $rows = ceil($loop_count/$cols);
> } elseif (empty($params['cols'])) {
> if (!empty($params['rows'])) {
> /* no cols specified, but rows */
> $cols = ceil($loop_count/$rows);
> }
> }
>
> Michael Kolakowski wrote:
>> Hi,
>>
>> I cannot seem to get the third table in this example to work:
>>
>> http://smarty.php.net/manual/en/lang...html.table.php
>>
>> I am using the latest smarty and php5 on a Mac. The problem is the
>> cols attribute. I typed it in exactly like the example and I get a
>> divide by zero error. I also tried declaring an array, with the col
>> names, in my php file. Then I tired using the array as such in my
>> template file:
>>
>> {html_table loop=$tableData cols=$colNames tr_attr=$colors}
>>
>> At which point the table finally showed up, BUT there was only one
>> column...and none of the column names were there. The alternating
>> colors worked, however.
>>
>> Thanks,
>> Michael Kolakowski
>>

>
>

  Réponse avec citation
Vieux 10/10/2006, 18h29   #3
Pedro
Aucun Avatar
 
Messages: n/a
Hébergeur:
Par défaut Re: [SMARTY] example not working...

Will look into this and correct as soon as possible.

Pete

Michael Kolakowski wrote:
> Thanks for the , Ken. However, I now have a couple new questions.
>
> First: There is a th_attr attribute listed for html_table (link
> below). I cannot get it to work. I tried using a string and assigning
> an array in the php file to be passed to the template. Neither worked.
>
> Second: I also tried, on a whim, to use the caption attribute. It
> seems fairly simple, but again, it does not work. My line looks like this:
>
> {html_table loop=$tableData cols=2 caption="hello"
> table_attr='border="2"' tr_attr=$colors}
>
> For what it's worth, I am getting a bit frustrated with html_table as
> things do not seem to be working as advertised. I would either
> appreciate corrections to the documentation or more examples showing how
> things work - e.g. and example using *all* the attributes for whatever
> function it is.
>
> Note: I am aware this is open source and many work very hard and
> volunteer. I fully respect that. I am not trying to be mean, just
> trying to give some feedback from a new user's point of view. That is
> important if you want people to adopt your product. By the way - I do
> like Smarty so far...very cool indeed.
>
> Thank you much,
> Michael Kolakowski
>
>
>
> Ken Snyder wrote:
>> It appears that the documentation is incorrect. Using version 2.6.14,
>> the cols parameter is only used as an integer. It has no
>> functionality to pass in column names or do <th> at all. You might
>> try a custom plugin from one of the plugin repositories.
>>
>> Ken
>>
>> From plugins/function.html_table.php
>>
>> $loop_count = count($loop);
>> if (empty($params['rows'])) {
>> /* no rows specified */
>> $rows = ceil($loop_count/$cols);
>> } elseif (empty($params['cols'])) {
>> if (!empty($params['rows'])) {
>> /* no cols specified, but rows */
>> $cols = ceil($loop_count/$rows);
>> }
>> }
>>
>> Michael Kolakowski wrote:
>>> Hi,
>>>
>>> I cannot seem to get the third table in this example to work:
>>>
>>> http://smarty.php.net/manual/en/lang...html.table.php
>>>
>>> I am using the latest smarty and php5 on a Mac. The problem is the
>>> cols attribute. I typed it in exactly like the example and I get a
>>> divide by zero error. I also tried declaring an array, with the col
>>> names, in my php file. Then I tired using the array as such in my
>>> template file:
>>>
>>> {html_table loop=$tableData cols=$colNames tr_attr=$colors}
>>>
>>> At which point the table finally showed up, BUT there was only one
>>> column...and none of the column names were there. The alternating
>>> colors worked, however.
>>>
>>> Thanks,
>>> Michael Kolakowski
>>>

>>
>>

  Réponse avec citation
Réponse


Outils de la discussion

Règles de messages
Vous ne pouvez pas créer de nouvelles discussions
Vous ne pouvez pas envoyer des réponses
Vous ne pouvez pas envoyer des pièces jointes
Vous ne pouvez pas modifier vos messages

Les balises BB sont activées : oui
Les smileys sont activés : oui
La balise [IMG] est activée : oui
Le code HTML peut être employé : non
Trackbacks are oui
Pingbacks are oui
Refbacks are oui


Fuseau horaire GMT +1. Il est actuellement 20h14.


Édité par : vBulletin® version 3.7.3
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Search Engine Friendly URLs by vBSEO 3.2.0 RC5 Tous droits réservés.
Version française #16 par l'association vBulletin francophone
PHWinfo est un site Éducation Sans Frontières ©2000-2008
Ad Management by RedTyger
©Tous droits réservés par les parties respectives
Page generated in 0,13245 seconds with 11 queries