Forum Index   FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 
Post new topic   Reply to topic
View previous topic Printable version Log in to check your private messages View next topic
Author Message
MACscrOffline



Joined: Jan 11, 2005
Posts: 128

Status: Offline
Post   Posted: Aug 26, 2005 - 11:30 PM Reply with quote Back to top

Ive kind of customized the pnGroups members listing template to show the members in it and their email address. Im trying to get the users to list in columns. Here is an example of what im trying to do.

Here is what i have now:

http://absreport.com/module-Contact_Us-memberslist-gid-24.htm

and im trying to turn it into this:

http://absreport.com/AboutUs-contacts.htm

Basically im just using the module as an easy way for the site moderators to add people to the contact list (which is a group). I know this is more of a pnRender guestion, but i havent been able to figure it out and you just so good at answering my questions. =P

Thanks,
MACscr
View user's profile Send private message Visit poster's website AIM Address
Chestnut
Site Admin


Joined: Oct 08, 2003
Posts: 1065
Location: Paris - France
Post   Posted: Aug 27, 2005 - 10:46 AM Reply with quote Back to top

I have a pnRender code somewhere that I did to do exactly that...
Trying to find it and coming back.

_________________
Chestnut ! Cool
Administrator
PNConcept.com
View user's profile Send private message Visit poster's website AIM Address Yahoo Messenger MSN Messenger ICQ Number
MACscrOffline



Joined: Jan 11, 2005
Posts: 128

Status: Offline
Post   Posted: Aug 27, 2005 - 11:03 AM Reply with quote Back to top

Thanks, I really appreciate it.
View user's profile Send private message Visit poster's website AIM Address
Chestnut
Site Admin


Joined: Oct 08, 2003
Posts: 1065
Location: Paris - France
Post   Posted: Aug 27, 2005 - 11:32 AM Reply with quote Back to top

Ok I found this... It was done to show 3 columns of links on a special module I made. You will see the result here : http://www.softcopyright.com/Liens.html

It is probably MUCH too complicated for nothing but it works. Note that some if else are probably useless but in my code, the borders were important. So there is probably too much in that and the final code for you will end up to be simpler.

Here is the full code, I'll explain below some part of it.

Code:

        <table>
          <tr>
            <!--[foreach item=link from=$linkitems key=itemkey]-->
              <!--[assign var="close" value=false]-->
              <!--[assign var="linkcheck" value=$linksonly[$itemkey].linkid]-->
              <!--[cycle name="counter" values="1,2,3" assign="counter"]-->
              <!--[cycle name="colcounter" values="1,1,1,2,2,2,3,3,3" assign="colcounter"]-->
              <!--[if $counter == 1]-->
                <!--[if $colcounter == 3]-->
                  <td style="text-align:left; border-right:0px #999999 solid; vertical-align:top; width:33%;">
                <!--[else]-->
                  <td style="text-align:left; border-right:1px #999999 solid; vertical-align:top; width:33%;">
                <!--[/if]-->
              <!--[/if]-->
              <!--[$link]-->
              <!--[if $counter == 3]--><!-- or $linkcheck == 7-->
                <!--[assign var="close" value=true]-->
                </td>
              <!--[/if]-->
            <!--[/foreach]-->
            <!--[if $close == false]-->
              </td>
            <!--[/if]-->
            <!--[if $colcounter != 3]-->
              <td style="text-align:left; border-right:0px #999999 solid; vertical-align:top; width:33%;">&nbsp;</td>
              <!--[math equation="x + y" x=$colcounter y=1 assign="colcounter"]-->
            <!--[/if]-->
            <!--[if $colcounter != 3]-->
              <td style="text-align:left; border-right:0px #999999 solid; vertical-align:top; width:33%;">&nbsp;</td>
              <!--[math equation="x + y" x=$colcounter y=1 assign="colcounter"]-->
            <!--[/if]-->
          </tr>
        </table>


To make it work I put that in a global table tag if I can say it this way and it is THAT table that has the 3 column layout.

Code:

        <table>
          <tr>


Then, the looping begins

Code:

            <!--[foreach item=link from=$linkitems key=itemkey]-->
              <!--[assign var="close" value=false]-->
              <!--[assign var="linkcheck" value=$linksonly[$itemkey].linkid]-->
              <!--[cycle name="counter" values="1,2,3" assign="counter"]-->
              <!--[cycle name="colcounter" values="1,1,1,2,2,2,3,3,3" assign="colcounter"]-->


Line 2 of the last part is a "close" variable that will serves as a trigger to see if we close the colunm if it has not been done.

I have no idea what is the linkcheck for the moment... I probably tried to go with the link numbers and decided otherwise after that. I remember that I tried a Smarty function (lastarrayline or something like that but I don't see it so I guess I left it out.

the cycle "counter" is the counter telling what link were putting in the column.
the cycle "colcounter" is also telling what link we are using but in wich column we are but since I wanted to have 3 links in each column, it was repeated the number of times needed : 1,1,1,2,2,2,3,3,3

Now the meat...

This part is opening the td tag... there is some checks to see if we have a right border or not so some of this is probably useless for you. The important part is the first $counter and the opening td.

If counter == 1 then were at the first link of the column, we must open the td.

Code:

              <!--[if $counter == 1]-->
                <!--[if $colcounter == 3]-->
                  <td style="text-align:left; border-right:0px #999999 solid; vertical-align:top; width:33%;">
                <!--[else]-->
                  <td style="text-align:left; border-right:1px #999999 solid; vertical-align:top; width:33%;">
                <!--[/if]-->
              <!--[/if]-->


Then we show the link :
Code:

<!--[$link]-->


After the link is shown, we check if we close the cell or not. (Basically if we are at the third link we are displaying or not).
The assign true to the close var will be used later to check if we need to close the td or not if we fall on a column that has less than 3 links. (3, 3, 2 for example).

Code:

              <!--[if $counter == 3]--><!-- or $linkcheck == 7-->
                <!--[assign var="close" value=true]-->
                </td>
              <!--[/if]-->


Now closing the loop
Code:

            <!--[/foreach]-->


And then, check if we have closed the column and if not, then we close it.
Code:

            <!--[if $close == false]-->
              </td>
            <!--[/if]-->


The next part was made to fill the last column with blank cells in fact... If the loop didn't end at the 3rd cell of the current column, then it was adding the remaining cell needed.

Code:

            <!--[if $colcounter != 3]-->
              <td style="text-align:left; border-right:0px #999999 solid; vertical-align:top; width:33%;">&nbsp;</td>
              <!--[math equation="x + y" x=$colcounter y=1 assign="colcounter"]-->
            <!--[/if]-->
            <!--[if $colcounter != 3]-->
              <td style="text-align:left; border-right:0px #999999 solid; vertical-align:top; width:33%;">&nbsp;</td>
              <!--[math equation="x + y" x=$colcounter y=1 assign="colcounter"]-->
            <!--[/if]-->


And finally... we close the main table.
Code:

          </tr>
        </table>


Looking at it, I have the big impression that it could have been done in a better way but heck... I don't see me touching this just for the fun. Smile

So that's it... This create a 3 column layout of links as shown on the link I gave at the beginning of the post.

Wink

_________________
Chestnut ! Cool
Administrator
PNConcept.com


Last edited by Chestnut on Aug 27, 2005 - 11:44 AM; edited 3 times in total
View user's profile Send private message Visit poster's website AIM Address Yahoo Messenger MSN Messenger ICQ Number
MACscrOffline



Joined: Jan 11, 2005
Posts: 128

Status: Offline
Post   Posted: Aug 27, 2005 - 07:32 PM Reply with quote Back to top

maybe its me, but when i read this code, it looks like its set to only work for 9 results. What if you have more?
View user's profile Send private message Visit poster's website AIM Address
Chestnut
Site Admin


Joined: Oct 08, 2003
Posts: 1065
Location: Paris - France
Post   Posted: Aug 27, 2005 - 07:58 PM Reply with quote Back to top

The pager ? Wink

In the example above, there is no pager shown because I didn't had any category with more than nine results. But with 12 results, page 1 would have look like this : http://www.softcopyright.com/Liens-auteurs.html and page 2 like this : http://www.softcopyright.com/Liens-producteurs.html

With of course... a pager at the bottom.

_________________
Chestnut ! Cool
Administrator
PNConcept.com


Last edited by Chestnut on Aug 27, 2005 - 07:59 PM; edited 1 time in total
View user's profile Send private message Visit poster's website AIM Address Yahoo Messenger MSN Messenger ICQ Number
MACscrOffline



Joined: Jan 11, 2005
Posts: 128

Status: Offline
Post   Posted: Aug 27, 2005 - 08:20 PM Reply with quote Back to top

I see what you did now, you just specified how many results u wanted per column. My problem is that i dont know how many i want per column, i just only want 3 columns and then have them divided amongst them. So is there a way to find out what the total number of members that are in the group and divided by 3? Then I can just assign that result to a variable or something. Hmm
View user's profile Send private message Visit poster's website AIM Address
Chestnut
Site Admin


Joined: Oct 08, 2003
Posts: 1065
Location: Paris - France
Post   Posted: Aug 27, 2005 - 09:21 PM Reply with quote Back to top

The nbusers variable is the total of users in the group :

Code:
<!--[$nbuser]-->


Wink

_________________
Chestnut ! Cool
Administrator
PNConcept.com
View user's profile Send private message Visit poster's website AIM Address Yahoo Messenger MSN Messenger ICQ Number
MACscrOffline



Joined: Jan 11, 2005
Posts: 128

Status: Offline
Post   Posted: Aug 27, 2005 - 11:31 PM Reply with quote Back to top

Well, I finally got things working the way I wanted them too. I had to basically write something new because I wanted to control how many columns their were, versus how many per column. Anyway, here is my ugly code:

Code:

<table>
   <tr>
      <td style="text-align:left; vertical-align:top; width:33%;">
         <!--[section name=members loop=$members]--> 
            <!--[math equation="(int)($nbuser / 3)+1" assign="per_col"]-->
            <!--[math equation="$per_col * 2" assign="sec_col"]-->
            <!--[math equation="$per_col + 1" assign="per_col_td"]-->
            <!--[math equation="$sec_col + 1" assign="sec_col_td"]-->
               <!--[if $smarty.section.members.iteration <= "$per_col"]-->
                     <div style="text-align:left;padding:2px;">
                        <!--[pnusergetvar name="_LASTNAME" uid=$members[members].pn_uid]-->, <!--[pnusergetvar name="_FIRSTNAME" uid=$members[members].pn_uid]-->
                     </div>
                     <div style="text-align:left;padding:2px 2px 10px 2px;">
                        <a href="mailto:<!--[$members[members].email|pnvarprepfordisplay|default:"&nbsp;"]-->"><!--[$members[members].email|pnvarprepfordisplay|default:"&nbsp;"]--></a>
                     </div>
               <!--[elseif $smarty.section.members.iteration <= "$sec_col"]-->
                  <!--[if $smarty.section.members.iteration == "$per_col_td"]-->
                        </td><td style="text-align:left; vertical-align:top; width:33%;">
                  <!--[/if]-->
                     <div style="text-align:left;padding:2px;">
                        <!--[pnusergetvar name="_LASTNAME" uid=$members[members].pn_uid]-->, <!--[pnusergetvar name="_FIRSTNAME" uid=$members[members].pn_uid]-->
                     </div>
                     <div style="text-align:left;padding:2px 2px 10px 2px;">
                        <a href="mailto:<!--[$members[members].email|pnvarprepfordisplay|default:"&nbsp;"]-->"><!--[$members[members].email|pnvarprepfordisplay|default:"&nbsp;"]--></a>
                     </div>
               <!--[else $smarty.section.members.iteration <= "$nbuser"]-->
                  <!--[if $smarty.section.members.iteration == "$sec_col_td"]-->
                     </td><td style="text-align:left; vertical-align:top; width:33%;">
                  <!--[/if]-->
                     <div style="text-align:left;padding:2px;">
                        <!--[pnusergetvar name="_LASTNAME" uid=$members[members].pn_uid]-->, <!--[pnusergetvar name="_FIRSTNAME" uid=$members[members].pn_uid]-->
                     </div>
                     <div style="text-align:left;padding:2px 2px 10px 2px;">
                        <a href="mailto:<!--[$members[members].email|pnvarprepfordisplay|default:"&nbsp;"]-->"><!--[$members[members].email|pnvarprepfordisplay|default:"&nbsp;"]--></a>
                     </div>
                  <!--[/if]-->
         <!--[/section]-->
      </td>
   </tr>
</table>   
View user's profile Send private message Visit poster's website AIM Address
MACscrOffline



Joined: Jan 11, 2005
Posts: 128

Status: Offline
Post   Posted: Aug 27, 2005 - 11:58 PM Reply with quote Back to top

Did a little work with the htaccess file to make the url a little friendlier, but here is what i have now.

http://absreport.com/ContactUs.htm

Now all admins have to do to add the user to the contact page is to add them to the user group "Contact_Page".

Until the pnGroups module gets a little more advanced, thats the only use I have for it now. =P

Thanks for your help Chestnut.
View user's profile Send private message Visit poster's website AIM Address
Display posts from previous:     
Jump to:  
All times are GMT + 1 Hour
Post new topic   Reply to topic
View previous topic Printable version Log in to check your private messages View next topic
Powered by PNphpBB2 © 2003-2004 The PNphpBB Group
Credits
DarkMindZ