article-listing in columns

Get help with installation and running phpwcms here. Please do not post bug reports or feature requests here.
macangelo
Posts: 756
Joined: Sat 29. Nov 2003, 14:19
Location: Düsseldorf
Contact:

Post by macangelo »

Hi Brans

Well, I chose to force it by a spacer in the table. IE made problems excepting these height-things, but this works at least ok:

http://www.eyelikeit.com/index.php?de_www_example_cms

I also posted this question in the selfhtml-forum but didn't get a solution I could use:

helphttp://forum.de.selfhtml.org/?t=109454&m=683958

Thanks for your Help

macangelo
Webdesign from Düsseldorf - made with phpwcms (most of it):
http://eyelikeit.com/index.php?de_beispiele-webdesign
kubens
Posts: 168
Joined: Sat 6. Nov 2004, 15:29
Location: Duesseldorf near Cologne ;-)

Post by kubens »

Based on the internal order of frontend rendering I pointed out the following solution. The code below renders an article list into a table which contains two columns. Just copy this source into an article list template.

Code: Select all

[PHP]   
  // number of columns 
  $GLOBALS['wak_cols'] = 2;

  // initialize or increase counter
  if (!isset($GLOBALS['wak_counter'])) {
    $GLOBALS['wak_counter'] = 0;
  }
  else {
    $GLOBALS['wak_counter']++;
  }
    
  // articles per listing
  // either topcount from category
  // or number of listed articles of category
  $article_id = "{ARTICLEID}";
  $article_cid = $GLOBALS['content']['articles'][$article_id]['article_cid'];
  
  if ($GLOBALS['content']['struct'][$article_cid]['acat_topcount'] < count($GLOBALS['content']['articles'])) {
    $GLOBALS['wak_articles_per_page'] = $GLOBALS['content']['struct'][$article_cid]['acat_topcount'];
  }
  else {
    $GLOBALS['wak_articles_per_page'] = count($GLOBALS['content']['articles']);
  }

  // create outer table 
  // which contains the columns
  if ($GLOBALS['wak_counter'] == 0) { echo "<table border='1'><tr>"; }
  
  // if number of columns per row
  // is reached then create new row
  if ($GLOBALS['wak_counter'] % $GLOBALS['wak_cols'] == 0) { echo "</tr><tr>"; }
[/PHP]

<td>

  <!-- content begin -->
  <table border="0" cellspacing="10">
    <tr>
      <td width="150" valign="top">
        [IMAGE]<div><a href="{ARTICLELINK}">{IMAGE}</a></div>[/IMAGE]
        [CAPTION]<div align="center">{CAPTION}</div>[/CAPTION]
      </td>
      <td valign="top">
        [TITLE]<h1 style="margin:0 0 5px 0;">{TITLE}</h1>[/TITLE]
        [SUB]<h3 style="margin:0 0 5px 0;">{SUB}</h3>[/SUB]
        [SUMMARY]<p style="margin:0">{SUMMARY}</p>[/SUMMARY]
        [MORE]<a href="{ARTICLELINK}">{MORE}</a>[/MORE]
      </td>
    </tr>
  </table>
  <!-- content end -->

</td>

[PHP] 
  // if number of articles per category 
  // is reached then close outer table  
  if ($GLOBALS['wak_counter']+1 == $GLOBALS['wak_articles_per_page']) { 
    
    // if last row does not contain enough 
    // columns then create a filler column
    if (($GLOBALS['wak_counter']+1) % $GLOBALS['wak_cols'] > 0 ) {
      echo "<td colspan='" . ($GLOBALS['wak_cols'] - (($GLOBALS['wak_counter']+1) % $GLOBALS['wak_cols'])) . "'>&nbsp;</td>";
    }  
    
    // close outer table
    echo "</tr></table>"; 
  }
[/PHP]
This source was tested successfully in phpWCMS v1.2.5-DEV. By the way, to integrate information from external tables (e.g. prices and stock information) inside an article listing, this is a very good approach.

BR
Wolfgang
kubens
Posts: 168
Joined: Sat 6. Nov 2004, 15:29
Location: Duesseldorf near Cologne ;-)

Post by kubens »

You can see this article list here. :shock:
macangelo
Posts: 756
Joined: Sat 29. Nov 2003, 14:19
Location: Düsseldorf
Contact:

Post by macangelo »

Thanks - and have a nice weekend

Macangelo
Webdesign from Düsseldorf - made with phpwcms (most of it):
http://eyelikeit.com/index.php?de_beispiele-webdesign
ChantalC
Posts: 16
Joined: Sun 24. Jul 2005, 18:25
Location: Berlin
Contact:

Post by ChantalC »

Ich habe ein ähnliches Problem. Ich möchte die Artikelliste rechts, aber nur die Images mit Link. Der Content der Artikel soll in der Mitte sein.

Meine Frage ist, wie bekomme ich die Artikelliste, nur Images, nach rechts?

Seitenlayout: Content + Rechts? mit welchen Replacement-Tags? oder über Tabelle oder über Layer?
Last edited by ChantalC on Sat 3. Sep 2005, 11:13, edited 1 time in total.
Gruß / regards

CC
kubens
Posts: 168
Joined: Sat 6. Nov 2004, 15:29
Location: Duesseldorf near Cologne ;-)

Post by kubens »

Please create an separate tmpl file and save it in the corresponding folder /phpwcms_template/inc_cntpart/articlesummary/list. Reasign the article list template to the corresponding articles... To achieve that the images in the article listing appears on the right side just modify the html source from my previous posting:

Code: Select all

<!-- content begin -->
<table border="0" cellspacing="10">
  <tr>
    <td valign="top">
      [TITLE]<h1 style="margin:0 0 5px 0;">{TITLE}</h1>[/TITLE]
      [SUB]<h3 style="margin:0 0 5px 0;">{SUB}</h3>[/SUB]
      [SUMMARY]<p style="margin:0">{SUMMARY}</p>[/SUMMARY]
      [MORE]<a href="{ARTICLELINK}">{MORE}</a>[/MORE]
    </td>
    <td width="150" valign="top">
      [IMAGE]<div><a href="{ARTICLELINK}">{IMAGE}</a></div>[/IMAGE]
      [CAPTION]<div align="center">{CAPTION}</div>[/CAPTION]
    </td>
  </tr>
</table>
<!-- content end --> 
BR
Wolfgang
ChantalC
Posts: 16
Joined: Sun 24. Jul 2005, 18:25
Location: Berlin
Contact:

Post by ChantalC »

Danke für die schnelle Antwort.

Aber irgendwas klappt nicht bei mir. Vielleicht ist es auch zu spät heute ( :? ).

Mein Ergebnist sieht jetzt so aus.

Wir kriege ich die Artikelliste (nur Images) nach rechts + den 1. Content in die Mitte?
Last edited by ChantalC on Sat 3. Sep 2005, 11:13, edited 1 time in total.
Gruß / regards

CC
kubens
Posts: 168
Joined: Sat 6. Nov 2004, 15:29
Location: Duesseldorf near Cologne ;-)

Post by kubens »

Okay, it seems that this isn't an article listing. Please verify your settings for the corresponding structure entry in your site structure. Especialy check top article count In case that you are not familiar with this parameter try to find out more details at Pappnase's famous Docupage :shock: If this is parameter is setuped correct, please verify the settings on article level concerning the right article listing template. See my previous posting. If you can't find a way to solve your problem send me a PM ;-)

BR
Wolfgang
User avatar
StudioZ
Posts: 802
Joined: Fri 28. May 2004, 19:57
Location: Québec, Canada
Contact:

Post by StudioZ »

Just discovered this thread here :roll:
and realized that it is VERY closely related to
erich_k4's famous {TEASER_EX} tag.
This tag is bringing up whole new possibilities and horizons. :)
I just posted there, some enhancements I would very soon need...
Please check:
http://www.phpwcms.de/forum/viewtopic.php?p=48696#48696

Cheers,

Yves
Image
PhpWCMS Evangelist, -- iRoutier.com Running phpWCMS 1.4.2, r354 -> Great Version!!!!
sCHL
Posts: 60
Joined: Wed 26. Jan 2005, 07:03

Post by sCHL »

Hi,

great Code, but I have a problem with the last part:

Code: Select all

[PHP]
  // if number of articles per category
  // is reached then close outer table 
  if ($GLOBALS['wak_counter']+1 == $GLOBALS['wak_articles_per_page']) {
   
    // if last row does not contain enough
    // columns then create a filler column
    if (($GLOBALS['wak_counter']+1) % $GLOBALS['wak_cols'] > 0 ) {
      echo "<td colspan='" . ($GLOBALS['wak_cols'] - (($GLOBALS['wak_counter']+1) % $GLOBALS['wak_cols'])) . "'>&nbsp;</td>";
    } 
   
    // close outer table
    echo "</tr></table>";
  }
[/PHP] 
In my case the closing tag is not generated. Perhaps it depends on the counting of the articles. Has anybody similar problems? Thanks for response...
sCHL
Posts: 60
Joined: Wed 26. Jan 2005, 07:03

Post by sCHL »

Ok, i got it: mixing of listing templates is not allowed. My first article listing ist a text which discribes the content. After this there a pictures for the portfolio. And this pictures have an other template...
Stim
Posts: 587
Joined: Mon 6. Jun 2005, 13:13

Post by Stim »

kubens wrote:Based on the internal order of frontend rendering I pointed out the following solution. The code below renders an article list into a table which contains two columns. Just copy this source into an article list template.

Code: Select all

[PHP]   
  // number of columns 
  $GLOBALS['wak_cols'] = 2;

  // initialize or increase counter
  if (!isset($GLOBALS['wak_counter'])) {
    $GLOBALS['wak_counter'] = 0;
  }
  else {
    $GLOBALS['wak_counter']++;
  }
    
  // articles per listing
  // either topcount from category
  // or number of listed articles of category
  $article_id = "{ARTICLEID}";
  $article_cid = $GLOBALS['content']['articles'][$article_id]['article_cid'];
  
  if ($GLOBALS['content']['struct'][$article_cid]['acat_topcount'] < count($GLOBALS['content']['articles'])) {
    $GLOBALS['wak_articles_per_page'] = $GLOBALS['content']['struct'][$article_cid]['acat_topcount'];
  }
  else {
    $GLOBALS['wak_articles_per_page'] = count($GLOBALS['content']['articles']);
  }

  // create outer table 
  // which contains the columns
  if ($GLOBALS['wak_counter'] == 0) { echo "<table border='1'><tr>"; }
  
  // if number of columns per row
  // is reached then create new row
  if ($GLOBALS['wak_counter'] % $GLOBALS['wak_cols'] == 0) { echo "</tr><tr>"; }
[/PHP]

<td>

  <!-- content begin -->
  <table border="0" cellspacing="10">
    <tr>
      <td width="150" valign="top">
        [IMAGE]<div><a href="{ARTICLELINK}">{IMAGE}</a></div>[/IMAGE]
        [CAPTION]<div align="center">{CAPTION}</div>[/CAPTION]
      </td>
      <td valign="top">
        [TITLE]<h1 style="margin:0 0 5px 0;">{TITLE}</h1>[/TITLE]
        [SUB]<h3 style="margin:0 0 5px 0;">{SUB}</h3>[/SUB]
        [SUMMARY]<p style="margin:0">{SUMMARY}</p>[/SUMMARY]
        [MORE]<a href="{ARTICLELINK}">{MORE}</a>[/MORE]
      </td>
    </tr>
  </table>
  <!-- content end -->

</td>

[PHP] 
  // if number of articles per category 
  // is reached then close outer table  
  if ($GLOBALS['wak_counter']+1 == $GLOBALS['wak_articles_per_page']) { 
    
    // if last row does not contain enough 
    // columns then create a filler column
    if (($GLOBALS['wak_counter']+1) % $GLOBALS['wak_cols'] > 0 ) {
      echo "<td colspan='" . ($GLOBALS['wak_cols'] - (($GLOBALS['wak_counter']+1) % $GLOBALS['wak_cols'])) . "'>&nbsp;</td>";
    }  
    
    // close outer table
    echo "</tr></table>"; 
  }
[/PHP]
This source was tested successfully in phpWCMS v1.2.5-DEV. By the way, to integrate information from external tables (e.g. prices and stock information) inside an article listing, this is a very good approach.

BR
Wolfgang


Hi
Nice cod!!
But I have some problem when I use other templates. Example: I have 5 articles and 4 of them I use 1.tmpl whit this cod above and locus like this:

Article 1:--------------------------------Article 2:
Text text text text text text----------Text text text text text text
Text text text text text text ---------Text text text text text text

Article 3:--------------------------------Article 4:
Text text text text text text---------Text text text text text text
Text text text text text text---------Text text text text text text


White article 5 I trying to make this lock:

Article 1:--------------------------------Article 2:
Text text text text text text----------Text text text text text text
Text text text text text text ---------Text text text text text text

Article 3:--------------------------------Article 4:
Text text text text text text---------Text text text text text text
Text text text text text text---------Text text text text text text

Article 5:
Text text text text text text text text text text text text text
Text text text text text text text text text text text text text

But its not work when I try to add other .tmpl. I think there maybe is something wrong in the cod above: Any ideas?
Stim
Posts: 587
Joined: Mon 6. Jun 2005, 13:13

Post by Stim »

OK
Already fixed…
sCHL
Posts: 60
Joined: Wed 26. Jan 2005, 07:03

Post by sCHL »

And how? It would be nice to post the solution for those with same problems :wink:
Stim
Posts: 587
Joined: Mon 6. Jun 2005, 13:13

Post by Stim »

Hello
Sorry! My solution was this topic http://www.phpwcms.de/forum/viewtopic.php?t=9597 only. :wink: But you have to remove that dotted thing. I don’t know why there are dots in that cod. But just remove it and then it will work
Post Reply