Un peu de mal avec le Homecustom
Visiteur
Boosteur Inactif
J'essaye de customiser le homecustom, cependant je rencontre quelques soucis. Vous pouvez vous rendre sur le site http://www.aufildariane.net afin de voir l'erreur en question.
Contenu du HomeCustomHomePageExtensionPoint.class.php :
Caché :
<?php
/*##################################################
* HomeCustomHomePageExtensionPoint.class.php
* -------------------
* begin : August 25, 2012
* copyright : (C) 2012 Kevin MASSY
* email : kevin.massy@phpboost.com
*
*
###################################################
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*
###################################################*/
class HomeCustomHomePageExtensionPoint implements HomePageExtensionPoint
{
private $template;
public function get_home_page()
{
$columns_disabled = Environment::get_graphical_environment()->get_columns_disabled();
$columns_disabled->set_disable_left_columns(true);
$columns_disabled->set_disable_right_columns(false);
$columns_disabled->set_disable_top_central(false);
$columns_disabled->set_disable_bottom_central(false);
return new DefaultHomePage($this->get_title(), $this->get_view());
}
private function get_title()
{
return LangLoader::get_message('title', 'common', 'HomeCustom');
}
private function get_view()
{
$this->template = new FileTemplate('HomeCustom/home.tpl');
$this->build_view();
return $this->template;
}
private function build_view()
{
$id_cats = array('2', '3', '4', '5', '6', '9', '10', '11', '12', '16', '17', '18');
$querier = PersistenceContext::get_querier();
$results = $querier->select('SELECT id, id_category, title, description, date_created, picture_url,
user.login
FROM ' . PREFIX . 'articles
LEFT JOIN ' . DB_TABLE_MEMBER . ' user ON user.user_id = author_user_id
WHERE published = 1 AND id_category IN (' . implode(', ', $id_cats) . ')
ORDER BY timestamp DESC');
$this->build_modules_view($results);
}
private function build_modules_view(SelectQueryResult $results)
{
$tpl = new FileTemplate('HomeCustom/modules.tpl');
$i = 0;
foreach ($results as $row)
{
if ($i >= 3)
{
break;
}
$link = new Url('/articles/' . url('.php?id=' . $row['id'], '-' . $row['id'] . '+' . Url::encode_rewrite($row['title']) . '.php'));
$tpl->assign_block_vars('item', array(
'U_LINK' => $link->absolute(),
'U_IMG' => Url::to_absolute($row['image']),
'C_IMG' => !empty($row['image']),
'TITLE' => $row['title'],
'DESC' => $row['short_contents'],
'PSEUDO' => $row['login']
));
$i++;
}
$this->template->put('MODULES', $tpl);
}
}
?>
/*##################################################
* HomeCustomHomePageExtensionPoint.class.php
* -------------------
* begin : August 25, 2012
* copyright : (C) 2012 Kevin MASSY
* email : kevin.massy@phpboost.com
*
*
###################################################
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*
###################################################*/
class HomeCustomHomePageExtensionPoint implements HomePageExtensionPoint
{
private $template;
public function get_home_page()
{
$columns_disabled = Environment::get_graphical_environment()->get_columns_disabled();
$columns_disabled->set_disable_left_columns(true);
$columns_disabled->set_disable_right_columns(false);
$columns_disabled->set_disable_top_central(false);
$columns_disabled->set_disable_bottom_central(false);
return new DefaultHomePage($this->get_title(), $this->get_view());
}
private function get_title()
{
return LangLoader::get_message('title', 'common', 'HomeCustom');
}
private function get_view()
{
$this->template = new FileTemplate('HomeCustom/home.tpl');
$this->build_view();
return $this->template;
}
private function build_view()
{
$id_cats = array('2', '3', '4', '5', '6', '9', '10', '11', '12', '16', '17', '18');
$querier = PersistenceContext::get_querier();
$results = $querier->select('SELECT id, id_category, title, description, date_created, picture_url,
user.login
FROM ' . PREFIX . 'articles
LEFT JOIN ' . DB_TABLE_MEMBER . ' user ON user.user_id = author_user_id
WHERE published = 1 AND id_category IN (' . implode(', ', $id_cats) . ')
ORDER BY timestamp DESC');
$this->build_modules_view($results);
}
private function build_modules_view(SelectQueryResult $results)
{
$tpl = new FileTemplate('HomeCustom/modules.tpl');
$i = 0;
foreach ($results as $row)
{
if ($i >= 3)
{
break;
}
$link = new Url('/articles/' . url('.php?id=' . $row['id'], '-' . $row['id'] . '+' . Url::encode_rewrite($row['title']) . '.php'));
$tpl->assign_block_vars('item', array(
'U_LINK' => $link->absolute(),
'U_IMG' => Url::to_absolute($row['image']),
'C_IMG' => !empty($row['image']),
'TITLE' => $row['title'],
'DESC' => $row['short_contents'],
'PSEUDO' => $row['login']
));
$i++;
}
$this->template->put('MODULES', $tpl);
}
}
?>
Ce que j'aimerai faire:
- récupérer les dernières news automatiquement,
- récupérer les derniers articles automatiquement,
- les classer par catégories, (un peu comme on peut le voir ici : http://www.shoot-event.com/pages/accueil ; donc: bloc news, puis 1 bloc par catégorie d'articles: 8 blocs articles donc)
- y intégrer le slider protoshow en haut de la page (NON mis à jour automatiquement, et qui prends la largeur du body)
- garder un bloc "derniers messages du forum"
Visuellement, ça devrait ressembler à ça:

C'est juste une image retouchée (qui ne ressemble a rien) pour que vous ayez une idée de ce que je cherche a faire.
En espérant tomber sur quelqu'un qui pourrait m"aider,
Antoine.
ElenWii Membre non connecté
-
Administrateur
- Voir le profil du membre ElenWii
- Inscrit le : 14/08/2009
- Site internet
- Groupes :
-
Equipe Graphique

Regarde dans la création des variables TPL, tu n'as pas les mêmes noms de variables que dans la requête SQL :
Code TEXT :
'U_IMG' => Url::to_absolute($row['image']),
Code TEXT :
$results = $querier->select('SELECT id, id_category, title, description, date_created, picture_url, il te faut prendre les mêmes noms que la base de donnée pour la requête SQL et réutiliser le même par la suite (ou alors le renommer dans la variable SQL mais pas trop d'utilité ici)
Ici c'est : picture_url dans la requete SQL donc
Code TEXT :
'U_IMG' => Url::to_absolute($row['picture_url']),
ElenWii
Visiteur
Boosteur Inactif

J'ai corrigé, j'ai commencé a m'attaquer au design, cependant j'ai encore d'autres soucis:
- Je n'arrive pas à récupérer l'image
- quoi que je fasse, impossible de réaliser deux fonctions identiques (au détail près des ID de catégories) afin de réaliser plusieurs blocs.
- Le fait que l'affichage soit fait par une boucle, m'empêche de réaliser un tableau de 4x2 avec les résultats. (je les met soit en ligne, soit en colonne, mais je n'arrive pas à faire le 4x2)
Voici mes fichiers:
HomeCustomHomePageExtensionPoint.class.php
Caché :
class HomeCustomHomePageExtensionPoint implements HomePageExtensionPoint
{
private $template;
public function get_home_page()
{
$columns_disabled = Environment::get_graphical_environment()->get_columns_disabled();
$columns_disabled->set_disable_left_columns(true);
$columns_disabled->set_disable_right_columns(false);
$columns_disabled->set_disable_top_central(false);
$columns_disabled->set_disable_bottom_central(false);
return new DefaultHomePage($this->get_title(), $this->get_view());
}
private function get_title()
{
return LangLoader::get_message('title', 'common', 'HomeCustom');
}
private function get_view()
{
$this->template = new FileTemplate('HomeCustom/home.tpl');
$this->build_view();
return $this->template;
}
private function build_view()
{
$id_cats = array('2', '3', '4', '5', '6', '9', '10', '11', '12', '16', '17', '18');
$querier = PersistenceContext::get_querier();
$results = $querier->select('SELECT id, id_category, title, description, date_created, picture_url,
user.login
FROM ' . PREFIX . 'articles
LEFT JOIN ' . DB_TABLE_MEMBER . ' user ON user.user_id = author_user_id
WHERE published = 1 AND id_category IN (' . implode(', ', $id_cats) . ')
ORDER BY timestamp DESC');
$this->build_modules_view($results);
}
private function build_modules_view(SelectQueryResult $results)
{
$tpl = new FileTemplate('HomeCustom/modules.tpl');
$i = 0;
foreach ($results as $row)
{
if ($i >= 8)
{
break;
}
$link = new Url('/articles/' . $row['id_category'] . url('.php?id=' . $row['id'], '-' . $row['id'] . '+' . Url::encode_rewrite($row['title']) . '.php'));
$tpl->assign_block_vars('item', array(
'U_LINK' => $link->absolute(),
'U_IMG' => Url::to_absolute($row['picture_url']),
'C_IMG' => !empty($row['image']),
'TITLE' => $row['title'],
'DESC' => $row['description'],
'PSEUDO' => $row['login']
));
$i++;
}
$this->template->put('MODULES', $tpl);
}
}
?>
{
private $template;
public function get_home_page()
{
$columns_disabled = Environment::get_graphical_environment()->get_columns_disabled();
$columns_disabled->set_disable_left_columns(true);
$columns_disabled->set_disable_right_columns(false);
$columns_disabled->set_disable_top_central(false);
$columns_disabled->set_disable_bottom_central(false);
return new DefaultHomePage($this->get_title(), $this->get_view());
}
private function get_title()
{
return LangLoader::get_message('title', 'common', 'HomeCustom');
}
private function get_view()
{
$this->template = new FileTemplate('HomeCustom/home.tpl');
$this->build_view();
return $this->template;
}
private function build_view()
{
$id_cats = array('2', '3', '4', '5', '6', '9', '10', '11', '12', '16', '17', '18');
$querier = PersistenceContext::get_querier();
$results = $querier->select('SELECT id, id_category, title, description, date_created, picture_url,
user.login
FROM ' . PREFIX . 'articles
LEFT JOIN ' . DB_TABLE_MEMBER . ' user ON user.user_id = author_user_id
WHERE published = 1 AND id_category IN (' . implode(', ', $id_cats) . ')
ORDER BY timestamp DESC');
$this->build_modules_view($results);
}
private function build_modules_view(SelectQueryResult $results)
{
$tpl = new FileTemplate('HomeCustom/modules.tpl');
$i = 0;
foreach ($results as $row)
{
if ($i >= 8)
{
break;
}
$link = new Url('/articles/' . $row['id_category'] . url('.php?id=' . $row['id'], '-' . $row['id'] . '+' . Url::encode_rewrite($row['title']) . '.php'));
$tpl->assign_block_vars('item', array(
'U_LINK' => $link->absolute(),
'U_IMG' => Url::to_absolute($row['picture_url']),
'C_IMG' => !empty($row['image']),
'TITLE' => $row['title'],
'DESC' => $row['description'],
'PSEUDO' => $row['login']
));
$i++;
}
$this->template->put('MODULES', $tpl);
}
}
?>
module.tpl:
Caché :
# START item #
<td>
<th>[url={item.U_LINK}]
# IF item.C_IMG #
<img src="{item.U_IMG}" title="{item.TITLE}" alt="{item.TITLE}" class="table tbody td" />
# ENDIF #
[/url]
</th>
<tr>
<td>[url={item.U_LINK}]{item.TITLE}
{item.DESC}
par : <span>{item.PSEUDO}</span></td>[/url]</td>
# END item #
<td>
<th>[url={item.U_LINK}]
# IF item.C_IMG #
<img src="{item.U_IMG}" title="{item.TITLE}" alt="{item.TITLE}" class="table tbody td" />
# ENDIF #
[/url]
</th>
<tr>
<td>[url={item.U_LINK}]{item.TITLE}
{item.DESC}
par : <span>{item.PSEUDO}</span></td>[/url]</td>
# END item #
home.tpl:
Caché :
<div class="center">Page d'accueil</div>
[table]
<thead> <!-- En-tête du tableau -->
<th>Les derniers articles</th>
</thead>
<tbody>
# INCLUDE MODULES #
</tbody>
[/table]
[table]
<thead> <!-- En-tête du tableau -->
<th>Les derniers articles</th>
</thead>
<tbody>
# INCLUDE MODULES #
</tbody>
[/table]
Et je suis allé chercher les tableaux phpboost de mon thème pour les classes : Homecustom.css :
Caché :
/* Tableaux
-------------------------------------- */
div#table {
width: 100%;
padding: 0px;
margin: 8px 0px;
border-spacing: 0;
display: table;
}
/* Entête */
table caption {
color: #757679;
font-size: 13px;
text-align: left;
margin: 5px 0 5px 20px;
border-bottom: 1px solid #D1D2D5;
}
table thead th {
padding: 8px;
background: -moz-linear-gradient(top, #26262c 0%, #000000 100%);
background: -webkit-gradient(linear, left top, left bottom, color-stop(0%, #26262c), color-stop(100%, #000000));
background: -webkit-linear-gradient(top, #26262c 0%, #000000 100%);
background: -o-linear-gradient(top, #26262c 0%, #000000 100%);
background: -ms-linear-gradient(top, #26262c 0%, #000000 100%);
background: linear-gradient(to bottom, #26262c 0%, #000000 100%);
color: #E5E6E6;
font-size: 12px;
text-align: center;
font-weight: normal;
}
table thead th:first-child { border-top-left-radius: 3px; }
table thead th:last-child { border-top-right-radius: 3px; }
table thead th a { color: #E5E6E6; }
table thead th a:hover { color: #FFFFFF; }
/* Contenu */
table tbody td {
background-color: #F5F5F5;
border-top: 1px solid #D1D2D4;
border-left: 1px solid #D1D2D4;
padding: 8px;
color: #676A74;
text-align: center;
width; 25%
}
table tbody tr:nth-child(even) td { background-color: #FFFFFF; width; 25%}
table tbody tr:last-child td { border-bottom: 1px solid #D1D2D4; width; 25%}
table tbody tr td:last-child { border-right: 1px solid #D1D2D4; width; 25%}
table tbody tr.no-separator td { border-top: none; width; 25%}
table tbody tr td.no-separator { border-left: none; width; 25%}
table tbody tr td.no-separator:first-child { border-left: 1px solid #D1D2D4; width; 25%}
/* Pied */
table tfoot tr th {
color: #AAAAAA;
background-color: #F0F0F0;
padding: 8px;
border-bottom: 1px solid #D1D2D4;
}
table tfoot tr th:first-child { border-left: 1px solid #D1D2D4; border-bottom-left-radius: 3px; }
table tfoot tr th:last-child { border-right: 1px solid #D1D2D4; border-bottom-right-radius: 3px; }
table tfoot tr th:only-child { text-align: right; }
table tfoot tr th * { vertical-align: middle; }
table tfoot tr th a { color: #676A74; }
table tfoot tr th select { padding: 2px 5px; }
/* Patch thead Tableaux formatés */
table.formater-table th.formater-table-head {
padding: 8px;
background: -moz-linear-gradient(top, #26262c 0%, #000000 100%);
background: -webkit-gradient(linear, left top, left bottom, color-stop(0%, #26262c), color-stop(100%, #000000));
background: -webkit-linear-gradient(top, #26262c 0%, #000000 100%);
background: -o-linear-gradient(top, #26262c 0%, #000000 100%);
background: -ms-linear-gradient(top, #26262c 0%, #000000 100%);
background: linear-gradient(to bottom, #26262c 0%, #000000 100%);
color: #E5E6E6;
font-size: 1.4em;
text-align: center;
font-weight: normal;
}
table.formatter-table th.formatter-table-head {
padding: 8px;
background: -moz-linear-gradient(top, #26262c 0%, #000000 100%);
background: -webkit-gradient(linear, left top, left bottom, color-stop(0%, #26262c), color-stop(100%, #000000));
background: -webkit-linear-gradient(top, #26262c 0%, #000000 100%);
background: -o-linear-gradient(top, #26262c 0%, #000000 100%);
background: -ms-linear-gradient(top, #26262c 0%, #000000 100%);
background: linear-gradient(to bottom, #26262c 0%, #000000 100%);
color: #E5E6E6;
font-size: 1.4em;
text-align: center;
font-weight: normal;
}
table.formatter-table th.formatter-table-head:first-child { border-top-left-radius: 3px; }
table.formatter-table th.formatter-table-head:last-child { border-top-right-radius: 3px; }
table.formatter-table th.formatter-table-head a { color: #E5E6E6; }
table.formatter-table th.formatter-table-head a:hover { color: #FFFFFF; }
table.formatter-table th.formatter-table-head p { margin-bottom: 0px; }
table.bb-table th.bb-table-head {
padding: 8px;
background: -moz-linear-gradient(top, #26262c 0%, #000000 100%);
background: -webkit-gradient(linear, left top, left bottom, color-stop(0%, #26262c), color-stop(100%, #000000));
background: -webkit-linear-gradient(top, #26262c 0%, #000000 100%);
background: -o-linear-gradient(top, #26262c 0%, #000000 100%);
background: -ms-linear-gradient(top, #26262c 0%, #000000 100%);
background: linear-gradient(to bottom, #26262c 0%, #000000 100%);
color: #E5E6E6;
font-size: 1.4em;
text-align: center;
font-weight: normal;
}
table.bb-table th.bb-table-head:first-child { border-top-left-radius: 3px; }
table.bb-table th.bb-table-head:last-child { border-top-right-radius: 3px; }
table.bb-table th.bb-table-head a { color: #E5E6E6; }
table.bb-table th.bb-table-head a:hover { color: #FFFFFF; }
table.bb-table th.bb-table-head p { margin-bottom: 0px; }
-------------------------------------- */
div#table {
width: 100%;
padding: 0px;
margin: 8px 0px;
border-spacing: 0;
display: table;
}
/* Entête */
table caption {
color: #757679;
font-size: 13px;
text-align: left;
margin: 5px 0 5px 20px;
border-bottom: 1px solid #D1D2D5;
}
table thead th {
padding: 8px;
background: -moz-linear-gradient(top, #26262c 0%, #000000 100%);
background: -webkit-gradient(linear, left top, left bottom, color-stop(0%, #26262c), color-stop(100%, #000000));
background: -webkit-linear-gradient(top, #26262c 0%, #000000 100%);
background: -o-linear-gradient(top, #26262c 0%, #000000 100%);
background: -ms-linear-gradient(top, #26262c 0%, #000000 100%);
background: linear-gradient(to bottom, #26262c 0%, #000000 100%);
color: #E5E6E6;
font-size: 12px;
text-align: center;
font-weight: normal;
}
table thead th:first-child { border-top-left-radius: 3px; }
table thead th:last-child { border-top-right-radius: 3px; }
table thead th a { color: #E5E6E6; }
table thead th a:hover { color: #FFFFFF; }
/* Contenu */
table tbody td {
background-color: #F5F5F5;
border-top: 1px solid #D1D2D4;
border-left: 1px solid #D1D2D4;
padding: 8px;
color: #676A74;
text-align: center;
width; 25%
}
table tbody tr:nth-child(even) td { background-color: #FFFFFF; width; 25%}
table tbody tr:last-child td { border-bottom: 1px solid #D1D2D4; width; 25%}
table tbody tr td:last-child { border-right: 1px solid #D1D2D4; width; 25%}
table tbody tr.no-separator td { border-top: none; width; 25%}
table tbody tr td.no-separator { border-left: none; width; 25%}
table tbody tr td.no-separator:first-child { border-left: 1px solid #D1D2D4; width; 25%}
/* Pied */
table tfoot tr th {
color: #AAAAAA;
background-color: #F0F0F0;
padding: 8px;
border-bottom: 1px solid #D1D2D4;
}
table tfoot tr th:first-child { border-left: 1px solid #D1D2D4; border-bottom-left-radius: 3px; }
table tfoot tr th:last-child { border-right: 1px solid #D1D2D4; border-bottom-right-radius: 3px; }
table tfoot tr th:only-child { text-align: right; }
table tfoot tr th * { vertical-align: middle; }
table tfoot tr th a { color: #676A74; }
table tfoot tr th select { padding: 2px 5px; }
/* Patch thead Tableaux formatés */
table.formater-table th.formater-table-head {
padding: 8px;
background: -moz-linear-gradient(top, #26262c 0%, #000000 100%);
background: -webkit-gradient(linear, left top, left bottom, color-stop(0%, #26262c), color-stop(100%, #000000));
background: -webkit-linear-gradient(top, #26262c 0%, #000000 100%);
background: -o-linear-gradient(top, #26262c 0%, #000000 100%);
background: -ms-linear-gradient(top, #26262c 0%, #000000 100%);
background: linear-gradient(to bottom, #26262c 0%, #000000 100%);
color: #E5E6E6;
font-size: 1.4em;
text-align: center;
font-weight: normal;
}
table.formatter-table th.formatter-table-head {
padding: 8px;
background: -moz-linear-gradient(top, #26262c 0%, #000000 100%);
background: -webkit-gradient(linear, left top, left bottom, color-stop(0%, #26262c), color-stop(100%, #000000));
background: -webkit-linear-gradient(top, #26262c 0%, #000000 100%);
background: -o-linear-gradient(top, #26262c 0%, #000000 100%);
background: -ms-linear-gradient(top, #26262c 0%, #000000 100%);
background: linear-gradient(to bottom, #26262c 0%, #000000 100%);
color: #E5E6E6;
font-size: 1.4em;
text-align: center;
font-weight: normal;
}
table.formatter-table th.formatter-table-head:first-child { border-top-left-radius: 3px; }
table.formatter-table th.formatter-table-head:last-child { border-top-right-radius: 3px; }
table.formatter-table th.formatter-table-head a { color: #E5E6E6; }
table.formatter-table th.formatter-table-head a:hover { color: #FFFFFF; }
table.formatter-table th.formatter-table-head p { margin-bottom: 0px; }
table.bb-table th.bb-table-head {
padding: 8px;
background: -moz-linear-gradient(top, #26262c 0%, #000000 100%);
background: -webkit-gradient(linear, left top, left bottom, color-stop(0%, #26262c), color-stop(100%, #000000));
background: -webkit-linear-gradient(top, #26262c 0%, #000000 100%);
background: -o-linear-gradient(top, #26262c 0%, #000000 100%);
background: -ms-linear-gradient(top, #26262c 0%, #000000 100%);
background: linear-gradient(to bottom, #26262c 0%, #000000 100%);
color: #E5E6E6;
font-size: 1.4em;
text-align: center;
font-weight: normal;
}
table.bb-table th.bb-table-head:first-child { border-top-left-radius: 3px; }
table.bb-table th.bb-table-head:last-child { border-top-right-radius: 3px; }
table.bb-table th.bb-table-head a { color: #E5E6E6; }
table.bb-table th.bb-table-head a:hover { color: #FFFFFF; }
table.bb-table th.bb-table-head p { margin-bottom: 0px; }
Si tu pouvais m'aider à comprendre et à avancer ça serait cool, parce que je viens d'y passer l'aprèm, et rien de ce que j'essaie, ne fonctionne.

merci d'avance,
Antoine.
ElenWii Membre non connecté
-
Administrateur
- Voir le profil du membre ElenWii
- Inscrit le : 14/08/2009
- Site internet
- Groupes :
-
Equipe Graphique
Ce n'est pas parce que le design que tu veux faire ressemble à un tableau qu'il faut utiliser un tableau HTML

Les tableaux sont fait pour faire des tableaux.
Dans ton cas, ce sont des blocs juxtaposés que tu peux facilement gérer avec un <div>, un display: inline-block; ou un float:left;
Tu peux même utiliser les display:flex; si tu veux.
Mais utiliser les tableaux est une mauvaise idée.
Dans le passage en V4.1, nous avons retirer autant de table que possible. (Il en reste encore dans certain module non converti MVC)
Les table sont vraiment pénible à personnaliser et ne facilite pas le code html.
Avec un div, c'est plus simple, plus propre et facilement personnalisable.
exemple :
Code TPL :
Il suffit de regler la taille pour afficher le nombre d'élement que tu veux

ElenWii
Visiteur
Boosteur Inactif

Grâce à toi j'ai réussi à les mettre en tableau, chaque élément prenant 25% de la largeur.
J'ai également réussi à intégrer le diaporama (images et liens en manuel, ils ne sont pas récupérés depuis la BDD, exactement comme je le souhaitais).

J'ai encore quatre soucis:
- 1) Comment récupérer et afficher l'image de l'article au-dessus du lien ?
- 2) Les liens ne sont pas valides (plus de détail ci-dessous)
- 3) Comment faire pour avoir cette fonction plusieurs fois afin de récupérer les infos de plusieurs catégories et d'avoir plusieurs tableaux ?
- 4) Comme tu peux le voir là: http://www.aufildariane.net/articles/2-les-recettes/ (par rapport à l'accueil), les articles ne sont pas récupérés dans l'ordre (le plus récent et un autre article sont "sautés et n'apparaissent pas sur l'accueil alors qu'ils sont dans les 4 plus récents).
Pour le point N°2) : j'ai modifié le code afin d'obtenir l'id de la catégorie, soit par exemple: http://www.aufildariane.net/articles/2-33+masala-chai.php (avant, c'était juste : http://www.aufildariane.net/articles/33+masala-chai.php) mais le lien correct est : http://www.aufildariane.net/articles/2-les-recettes/33-masala-chai/
Je n'arrive pas à modifier plus la création du lien pour obtenir l'url correcte.
voici mon code HomeCustomHomePageExtensionPoint.class.php actuel:
Caché :
Code PHP :
<?php /*################################################## * HomeCustomHomePageExtensionPoint.class.php * ------------------- * begin : August 25, 2012 * copyright : (C) 2012 Kevin MASSY * email : kevin.massy@phpboost.com * * ################################################### * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. * ###################################################*/ class HomeCustomHomePageExtensionPoint implements HomePageExtensionPoint { private $template; public function get_home_page() { $columns_disabled = Environment::get_graphical_environment()->get_columns_disabled(); $columns_disabled->set_disable_left_columns(true); $columns_disabled->set_disable_right_columns(false); $columns_disabled->set_disable_top_central(false); $columns_disabled->set_disable_bottom_central(false); return new DefaultHomePage($this->get_title(), $this->get_view()); } private function get_title() { return LangLoader::get_message('title', 'common', 'HomeCustom'); } private function get_view() { $this->template = new FileTemplate('HomeCustom/home.tpl'); $this->build_view(); return $this->template; } private function build_view() { $id_cats = array('2'); $querier = PersistenceContext::get_querier(); $results = $querier->select('SELECT id, id_category, title, description, date_created, picture_url, user.login FROM ' . PREFIX . 'articles LEFT JOIN ' . DB_TABLE_MEMBER . ' user ON user.user_id = author_user_id WHERE published = 1 AND id_category IN (' . implode(', ', $id_cats) . ') ORDER BY timestamp DESC'); $this->build_modules_view($results); } private function build_modules_view(SelectQueryResult $results) { $tpl = new FileTemplate('HomeCustom/modules.tpl'); $i = 0; foreach ($results as $row) { if ($i >= 4) { break; } $link = new Url('/articles/' . $row['id_category'] . url('.php?id=' . $row['id'], '-' . $row['id'] . '+' . Url::encode_rewrite($row['title']) . '.php')); $tpl->assign_block_vars('item', array( 'U_LINK' => $link->absolute(), 'U_IMG' => Url::to_absolute($row['picture_url']), 'C_IMG' => !empty($row['image']), 'TITLE' => $row['title'], 'DESC' => $row['description'], 'PSEUDO' => $row['login'] )); $i++; } $this->template->put('MODULES', $tpl); } } ?>
Édité par Visiteur Le 05/10/2014 à 22h49
ElenWii Membre non connecté
-
Administrateur
- Voir le profil du membre ElenWii
- Inscrit le : 14/08/2009
- Site internet
- Groupes :
-
Equipe Graphique
Un div global qui contient deux div. Le premier pour l'image et le second le texte.
Il te suffit de copier autant de fois le code (en remplacant les noms de fonction et de variable) pour récuper les catégories ou les autres modules etc...
Il doit y avoir moyen de faire plus court, mais je ne suis pas expert en php
Visiteur
Boosteur Inactif
Code PHP :
'U_LINK' => $link->absolute(), 'U_IMG' => Url::to_absolute($row['picture_url']), 'C_IMG' => !empty($row['image']), 'TITLE' => $row['title'], 'DESC' => $row['description'], 'PSEUDO' => $row['login']
Mais ceci :
Code PHP :
'U_LINK' => $link->absolute(), 'U_IMG' => Url::to_absolute($row['picture_url']), 'C_IMG' => !empty($row['picture_url']), 'TITLE' => $row['title'], 'DESC' => $row['description'], 'PSEUDO' => $row['login']
Et ça ne m'affichais pas d'erreur car le !empty fait qu'effectivement, la variable étant fausse, et donc vide, rien n'était affiché.
Le point N°1) est donc réglé.
Pour les 3 autres, je stagne toujours autant..
Édité par Visiteur Le 06/10/2014 à 01h23
Visiteur
Boosteur Inactif
Je détaille, pour ceux qui seraient intéressés par la suite:
Vu que je récupère les article d'une seule catégorie, j'ai pu "tricher" sur la génération d'url en y incluant la catégorie dans le php, et en modifiant toute la syntaxe de la création d'url. voici mon résultat actuel:
Code PHP :
$link = new Url('/articles/2-les-recettes/' . url($row['id'] . '-' . Url::encode_rewrite($row['title']) . '/'));
Fonctionne avec tous les articles de la catégorie en question
J'ai par contre, vraiment besoin d'aide pour les points N°3) et N°4) .
Moi et les heures que j'ai pu y passer n'arrivent pas à bout de ces deux petits point.
Help !
Pour rappel:
- 3) Comment faire pour avoir cette fonction plusieurs fois afin de récupérer les infos de plusieurs catégories et d'avoir plusieurs tableaux ? J'ai dejà essayé de dupliquer et changer les noms des variables et des fonctions, mais je dois mal m'y prendre (je suis pas une flèche en php), parce que la page ne s'affiche carrément plus a chaque fois que j'essaie.
- 4) Comme vous pouvez le voir là: http://www.aufildariane.net/articles/2-les-recettes/ (par rapport à l'accueil), les articles ne sont pas récupérés dans l'ordre (le plus récent et un autre article sont "sautés" et n'apparaissent pas sur l'accueil alors qu'ils sont dans les 4 plus récents).
Édité par Visiteur Le 06/10/2014 à 01h22
ElenWii Membre non connecté
-
Administrateur
- Voir le profil du membre ElenWii
- Inscrit le : 14/08/2009
- Site internet
- Groupes :
-
Equipe Graphique
Code PHP :
$results = $querier->select('SELECT id, id_category, title, description, date_created, picture_url, user.login FROM ' . PREFIX . 'articles LEFT JOIN ' . DB_TABLE_MEMBER . ' user ON user.user_id = author_user_id WHERE published = 1 AND id_category IN (' . implode(', ', $id_cats) . ') ORDER BY timestamp DESC');
avec ceci par exemple :
Code PHP :
$results-cat1 = $querier->select('SELECT id, id_category, title, description, date_created, picture_url, user.login FROM ' . PREFIX . 'articles LEFT JOIN ' . DB_TABLE_MEMBER . ' user ON user.user_id = author_user_id WHERE published = 1 AND id_category IN (' . implode(', ', $id_cats) . ') ORDER BY timestamp DESC');
et après tu appel une autre fonction similaire
Code PHP :
private function build_modules_view(SelectQueryResult $results) { $tpl = new FileTemplate('HomeCustom/modules.tpl'); $i = 0; foreach ($results as $row) { if ($i >= 4) { break; } $link = new Url('/articles/' . $row['id_category'] . url('.php?id=' . $row['id'], '-' . $row['id'] . '+' . Url::encode_rewrite($row['title']) . '.php')); $tpl->assign_block_vars('item', array( 'U_LINK' => $link->absolute(), 'U_IMG' => Url::to_absolute($row['picture_url']), 'C_IMG' => !empty($row['image']), 'TITLE' => $row['title'], 'DESC' => $row['description'], 'PSEUDO' => $row['login'] )); $i++; } $this->template->put('MODULES', $tpl); }
Pour l'url, il te faut récuperer l'url recode de la catégorie de l'article pour l'ajouter.
Un dev pourra t'aider plus facilement que moi
Visiteur
Boosteur Inactif
Pourrais-tu (ou un dev), incorporer la seconde requête dans le fichier complet que voilà:
Caché :
Code PHP :
<?php /*################################################## * HomeCustomHomePageExtensionPoint.class.php * ------------------- * begin : August 25, 2012 * copyright : (C) 2012 Kevin MASSY * email : kevin.massy@phpboost.com * * ################################################### * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. * ###################################################*/ class HomeCustomHomePageExtensionPoint implements HomePageExtensionPoint { private $template; public function get_home_page() { $columns_disabled = Environment::get_graphical_environment()->get_columns_disabled(); $columns_disabled->set_disable_left_columns(true); $columns_disabled->set_disable_right_columns(false); $columns_disabled->set_disable_top_central(false); $columns_disabled->set_disable_bottom_central(false); return new DefaultHomePage($this->get_title(), $this->get_view()); } private function get_title() { return LangLoader::get_message('title', 'common', 'HomeCustom'); } private function get_view() { $this->template = new FileTemplate('HomeCustom/home.tpl'); $this->build_view(); return $this->template; } private function build_feed_news_view() { $feed_template = new FileTemplate('HomeCustom/feed_forum.tpl'); $this->template->put('FEED_NEWS', Feed::get_parsed('forum', Feed::DEFAULT_FEED_NAME, 0, $feed_template, 8)); } private function build_view() { $id_cats = array('2'); $querier = PersistenceContext::get_querier(); $results = $querier->select('SELECT id, id_category, title, description, date_created, picture_url, user.login FROM ' . PREFIX . 'articles LEFT JOIN ' . DB_TABLE_MEMBER . ' user ON user.user_id = author_user_id WHERE published = 1 AND id_category IN (' . implode(', ', $id_cats) . ') ORDER BY timestamp DESC'); $this->build_feed_news_view(); $this->build_modules_view($results); } private function build_modules_view(SelectQueryResult $results) { $tpl = new FileTemplate('HomeCustom/recettes.tpl'); $i = 0; foreach ($results as $row) { if ($i >= 4) { break; } $link = new Url('/articles/2-les-recettes/' . url($row['id'] . '-' . Url::encode_rewrite($row['title']) . '/')); $tpl->assign_block_vars('item', array( 'U_LINK' => $link->absolute(), 'U_IMG' => Url::to_absolute($row['picture_url']), 'C_IMG' => !empty($row['picture_url']), 'TITLE' => $row['title'], 'DESC' => $row['description'], 'PSEUDO' => $row['login'] )); $i++; } $this->template->put('RECETTES', $tpl); } } ?>
Car peut être que je plaçais la seconde requête à un mauvais endroit.
Cependant j'ai essayé de changer le nom des variables, des fonctions, et après de faire comme tu viens de me l'indiquer, et cela me retourne toujours une page vide.
merci de m'aider en tout cas Elenwii !

Peut être qu'un dev pourra me répondre plus spécifiquement en ce qui concerne la partie php, plus qu'à attendre qu'il y en ai un qui pointe son nez sur ce topic
(dans pas trop longtemps j'espère
)
Édité par Visiteur Le 06/10/2014 à 12h06
ElenWii Membre non connecté
-
Administrateur
- Voir le profil du membre ElenWii
- Inscrit le : 14/08/2009
- Site internet
- Groupes :
-
Equipe Graphique

Essaye avec ceci.
Tu fera attention, j'ai modifier les noms de fichiers tpl et les variables tpl.
Montre moi ton code tpl que tu auras dans home.tpl, cat1.tpl et cat2.tpl.
Code PHP :
<?php /*################################################## * HomeCustomHomePageExtensionPoint.class.php * ------------------- * begin : August 25, 2012 * copyright : (C) 2012 Kevin MASSY * email : kevin.massy@phpboost.com * * ################################################### * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. * ###################################################*/ class HomeCustomHomePageExtensionPoint implements HomePageExtensionPoint { private $template; public function get_home_page() { $columns_disabled = Environment::get_graphical_environment()->get_columns_disabled(); $columns_disabled->set_disable_left_columns(true); $columns_disabled->set_disable_right_columns(false); $columns_disabled->set_disable_top_central(false); $columns_disabled->set_disable_bottom_central(false); return new DefaultHomePage($this->get_title(), $this->get_view()); } private function get_title() { return LangLoader::get_message('title', 'common', 'HomeCustom'); } private function get_view() { $this->template = new FileTemplate('HomeCustom/home.tpl'); $this->build_view(); return $this->template; } private function build_view() { $id_cats = array('2'); $querier = PersistenceContext::get_querier(); $results_cat1 = $querier->select('SELECT id, id_category, title, description, date_created, picture_url, user.login FROM ' . PREFIX . 'articles LEFT JOIN ' . DB_TABLE_MEMBER . ' user ON user.user_id = author_user_id WHERE published = 1 AND id_category IN (' . implode(', ', $id_cats) . ') ORDER BY timestamp DESC'); $this->build_cat1_view($results_cat1); $id_cats = array('3'); $querier = PersistenceContext::get_querier(); $results_cat2 = $querier->select('SELECT id, id_category, title, description, date_created, picture_url, user.login FROM ' . PREFIX . 'articles LEFT JOIN ' . DB_TABLE_MEMBER . ' user ON user.user_id = author_user_id WHERE published = 1 AND id_category IN (' . implode(', ', $id_cats) . ') ORDER BY timestamp DESC'); $this->build_cat2_view($results_cat2); $this->build_feed_forum_view(); } private function build_feed_forum_view() { $feed_template = new FileTemplate('HomeCustom/feed_forum.tpl'); $this->template->put('FEED_FORUM', Feed::get_parsed('forum', Feed::DEFAULT_FEED_NAME, 0, $feed_template, 8)); } private function build_cat1_view(SelectQueryResult $results) { $tpl = new FileTemplate('HomeCustom/cat1.tpl'); $i = 0; foreach ($results as $row) { if ($i >= 4) { break; } $link = new Url('/articles/2-les-recettes/' . url($row['id'] . '-' . Url::encode_rewrite($row['title']) . '/')); $tpl->assign_block_vars('item', array( 'U_LINK' => $link->absolute(), 'U_IMG' => Url::to_absolute($row['picture_url']), 'C_IMG' => !empty($row['picture_url']), 'TITLE' => $row['title'], 'DESC' => $row['description'], 'PSEUDO' => $row['login'] )); $i++; } $this->template->put('CAT1', $tpl); } private function build_cat2_view(SelectQueryResult $results) { $tpl = new FileTemplate('HomeCustom/cat2.tpl'); $i = 0; foreach ($results as $row) { if ($i >= 4) { break; } $link = new Url('/articles/2-les-recettes/' . url($row['id'] . '-' . Url::encode_rewrite($row['title']) . '/')); $tpl->assign_block_vars('item', array( 'U_LINK' => $link->absolute(), 'U_IMG' => Url::to_absolute($row['picture_url']), 'C_IMG' => !empty($row['picture_url']), 'TITLE' => $row['title'], 'DESC' => $row['description'], 'PSEUDO' => $row['login'] )); $i++; } $this->template->put('CAT2', $tpl); } } ?>
Pour l'url, il faut modifier la requête sql. Je vais voir si j'y arrive seul ce soir
Visiteur
Boosteur Inactif
J'ai pu trouver la logique et dupliquer autant que nécessaire !
voici mon php fonctionnel:
Caché :
Code PHP :
<?php /*################################################## * HomeCustomHomePageExtensionPoint.class.php * ------------------- * begin : August 25, 2012 * copyright : (C) 2012 Kevin MASSY * email : kevin.massy@phpboost.com * * ################################################### * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. * ###################################################*/ class HomeCustomHomePageExtensionPoint implements HomePageExtensionPoint { private $template; public function get_home_page() { $columns_disabled = Environment::get_graphical_environment()->get_columns_disabled(); $columns_disabled->set_disable_left_columns(true); $columns_disabled->set_disable_right_columns(false); $columns_disabled->set_disable_top_central(false); $columns_disabled->set_disable_bottom_central(false); return new DefaultHomePage($this->get_title(), $this->get_view()); } private function get_title() { return LangLoader::get_message('title', 'common', 'HomeCustom'); } private function get_view() { $this->template = new FileTemplate('HomeCustom/home.tpl'); $this->build_view(); return $this->template; } private function build_view() { $id_cats = array('2'); $querier = PersistenceContext::get_querier(); $results_cat1 = $querier->select('SELECT id, id_category, title, description, date_created, picture_url, user.login FROM ' . PREFIX . 'articles LEFT JOIN ' . DB_TABLE_MEMBER . ' user ON user.user_id = author_user_id WHERE published = 1 AND id_category IN (' . implode(', ', $id_cats) . ') ORDER BY timestamp DESC'); $this->build_cat1_view($results_cat1); $id_cats = array('4'); $querier = PersistenceContext::get_querier(); $results_cat2 = $querier->select('SELECT id, id_category, title, description, date_created, picture_url, user.login FROM ' . PREFIX . 'articles LEFT JOIN ' . DB_TABLE_MEMBER . ' user ON user.user_id = author_user_id WHERE published = 1 AND id_category IN (' . implode(', ', $id_cats) . ') ORDER BY timestamp DESC'); $this->build_cat2_view($results_cat2); $id_cats = array('5'); $querier = PersistenceContext::get_querier(); $results_cat3 = $querier->select('SELECT id, id_category, title, description, date_created, picture_url, user.login FROM ' . PREFIX . 'articles LEFT JOIN ' . DB_TABLE_MEMBER . ' user ON user.user_id = author_user_id WHERE published = 1 AND id_category IN (' . implode(', ', $id_cats) . ') ORDER BY timestamp DESC'); $this->build_cat3_view($results_cat3); $id_cats = array('6'); $querier = PersistenceContext::get_querier(); $results_cat4 = $querier->select('SELECT id, id_category, title, description, date_created, picture_url, user.login FROM ' . PREFIX . 'articles LEFT JOIN ' . DB_TABLE_MEMBER . ' user ON user.user_id = author_user_id WHERE published = 1 AND id_category IN (' . implode(', ', $id_cats) . ') ORDER BY timestamp DESC'); $this->build_cat4_view($results_cat4); $id_cats = array('9'); $querier = PersistenceContext::get_querier(); $results_cat5 = $querier->select('SELECT id, id_category, title, description, date_created, picture_url, user.login FROM ' . PREFIX . 'articles LEFT JOIN ' . DB_TABLE_MEMBER . ' user ON user.user_id = author_user_id WHERE published = 1 AND id_category IN (' . implode(', ', $id_cats) . ') ORDER BY timestamp DESC'); $this->build_cat5_view($results_cat5); $id_cats = array('10'); $querier = PersistenceContext::get_querier(); $results_cat6 = $querier->select('SELECT id, id_category, title, description, date_created, picture_url, user.login FROM ' . PREFIX . 'articles LEFT JOIN ' . DB_TABLE_MEMBER . ' user ON user.user_id = author_user_id WHERE published = 1 AND id_category IN (' . implode(', ', $id_cats) . ') ORDER BY timestamp DESC'); $this->build_cat6_view($results_cat6); $id_cats = array('16'); $querier = PersistenceContext::get_querier(); $results_cat7 = $querier->select('SELECT id, id_category, title, description, date_created, picture_url, user.login FROM ' . PREFIX . 'articles LEFT JOIN ' . DB_TABLE_MEMBER . ' user ON user.user_id = author_user_id WHERE published = 1 AND id_category IN (' . implode(', ', $id_cats) . ') ORDER BY timestamp DESC'); $this->build_cat7_view($results_cat7); $id_cats = array('17'); $querier = PersistenceContext::get_querier(); $results_cat8 = $querier->select('SELECT id, id_category, title, description, date_created, picture_url, user.login FROM ' . PREFIX . 'articles LEFT JOIN ' . DB_TABLE_MEMBER . ' user ON user.user_id = author_user_id WHERE published = 1 AND id_category IN (' . implode(', ', $id_cats) . ') ORDER BY timestamp DESC'); $this->build_cat8_view($results_cat8); $this->build_feed_forum_view(); } private function build_feed_forum_view() { $feed_template = new FileTemplate('HomeCustom/feed_forum.tpl'); $this->template->put('FEED_FORUM', Feed::get_parsed('forum', Feed::DEFAULT_FEED_NAME, 0, $feed_template, 8)); } private function build_cat1_view(SelectQueryResult $results) { $tpl = new FileTemplate('HomeCustom/recettes.tpl'); $i = 0; foreach ($results as $row) { if ($i >= 4) { break; } $link = new Url('/articles/2-les-recettes/' . url($row['id'] . '-' . Url::encode_rewrite($row['title']) . '/')); $tpl->assign_block_vars('item', array( 'U_LINK' => $link->absolute(), 'U_IMG' => Url::to_absolute($row['picture_url']), 'C_IMG' => !empty($row['picture_url']), 'TITLE' => $row['title'], 'DESC' => $row['description'], 'PSEUDO' => $row['login'] )); $i++; } $this->template->put('RECETTES', $tpl); } private function build_cat2_view(SelectQueryResult $results) { $tpl = new FileTemplate('HomeCustom/hygiene.tpl'); $i = 0; foreach ($results as $row) { if ($i >= 4) { break; } $link = new Url('/articles/4-hygiene-et-beaute/' . url($row['id'] . '-' . Url::encode_rewrite($row['title']) . '/')); $tpl->assign_block_vars('item', array( 'U_LINK' => $link->absolute(), 'U_IMG' => Url::to_absolute($row['picture_url']), 'C_IMG' => !empty($row['picture_url']), 'TITLE' => $row['title'], 'DESC' => $row['description'], 'PSEUDO' => $row['login'] )); $i++; } $this->template->put('HYGIENE', $tpl); } private function build_cat3_view(SelectQueryResult $results) { $tpl = new FileTemplate('HomeCustom/modif.tpl'); $i = 0; foreach ($results as $row) { if ($i >= 4) { break; } $link = new Url('/articles/5-modifications-corporelles/' . url($row['id'] . '-' . Url::encode_rewrite($row['title']) . '/')); $tpl->assign_block_vars('item', array( 'U_LINK' => $link->absolute(), 'U_IMG' => Url::to_absolute($row['picture_url']), 'C_IMG' => !empty($row['picture_url']), 'TITLE' => $row['title'], 'DESC' => $row['description'], 'PSEUDO' => $row['login'] )); $i++; } $this->template->put('MODIF', $tpl); } private function build_cat4_view(SelectQueryResult $results) { $tpl = new FileTemplate('HomeCustom/esprit.tpl'); $i = 0; foreach ($results as $row) { if ($i >= 4) { break; } $link = new Url('/articles/6-nourriture-pour-l-esprit/' . url($row['id'] . '-' . Url::encode_rewrite($row['title']) . '/')); $tpl->assign_block_vars('item', array( 'U_LINK' => $link->absolute(), 'U_IMG' => Url::to_absolute($row['picture_url']), 'C_IMG' => !empty($row['picture_url']), 'TITLE' => $row['title'], 'DESC' => $row['description'], 'PSEUDO' => $row['login'] )); $i++; } $this->template->put('ESPRIT', $tpl); } private function build_cat5_view(SelectQueryResult $results) { $tpl = new FileTemplate('HomeCustom/tutos.tpl'); $i = 0; foreach ($results as $row) { if ($i >= 4) { break; } $link = new Url('/articles/9-tutoriels-astuces/' . url($row['id'] . '-' . Url::encode_rewrite($row['title']) . '/')); $tpl->assign_block_vars('item', array( 'U_LINK' => $link->absolute(), 'U_IMG' => Url::to_absolute($row['picture_url']), 'C_IMG' => !empty($row['picture_url']), 'TITLE' => $row['title'], 'DESC' => $row['description'], 'PSEUDO' => $row['login'] )); $i++; } $this->template->put('TUTOS', $tpl); } private function build_cat6_view(SelectQueryResult $results) { $tpl = new FileTemplate('HomeCustom/deco.tpl'); $i = 0; foreach ($results as $row) { if ($i >= 4) { break; } $link = new Url('/articles/10-deco/' . url($row['id'] . '-' . Url::encode_rewrite($row['title']) . '/')); $tpl->assign_block_vars('item', array( 'U_LINK' => $link->absolute(), 'U_IMG' => Url::to_absolute($row['picture_url']), 'C_IMG' => !empty($row['picture_url']), 'TITLE' => $row['title'], 'DESC' => $row['description'], 'PSEUDO' => $row['login'] )); $i++; } $this->template->put('DECO', $tpl); } private function build_cat7_view(SelectQueryResult $results) { $tpl = new FileTemplate('HomeCustom/sante.tpl'); $i = 0; foreach ($results as $row) { if ($i >= 4) { break; } $link = new Url('/articles/16-sante/' . url($row['id'] . '-' . Url::encode_rewrite($row['title']) . '/')); $tpl->assign_block_vars('item', array( 'U_LINK' => $link->absolute(), 'U_IMG' => Url::to_absolute($row['picture_url']), 'C_IMG' => !empty($row['picture_url']), 'TITLE' => $row['title'], 'DESC' => $row['description'], 'PSEUDO' => $row['login'] )); $i++; } $this->template->put('SANTE', $tpl); } private function build_cat8_view(SelectQueryResult $results) { $tpl = new FileTemplate('HomeCustom/autres.tpl'); $i = 0; foreach ($results as $row) { if ($i >= 4) { break; } $link = new Url('/articles/16-autres-articles/' . url($row['id'] . '-' . Url::encode_rewrite($row['title']) . '/')); $tpl->assign_block_vars('item', array( 'U_LINK' => $link->absolute(), 'U_IMG' => Url::to_absolute($row['picture_url']), 'C_IMG' => !empty($row['picture_url']), 'TITLE' => $row['title'], 'DESC' => $row['description'], 'PSEUDO' => $row['login'] )); $i++; } $this->template->put('AUTRES', $tpl); } } ?>
J'ai dupliqué pour toutes mes catégories d'articles, toujours en trichant sur les url générées à chaque fois. J'ai également (par rapport au code que tu viens de me donner), modifié le nom des TPL et de leurs fonctions associées pour mieux m'y retrouver.
Il me reste que de la mise en page à faire ! Donc si le code est un peu brouillon et que la mise en page n'est pas terrible pour l'instant, ne t'inquiète pas
Même si, et surtout venant d'un graphiste, je suis à 200% preneur de la moindre remarque ou critique 
Voici mon home.tpl :
Caché :
Code HTML :
<div id="myshow1" class="protoshow"> <ul class="show"> <li class="slide" data-slide-interval=""> <a href="http://www.aufildariane.net/news/1-annonces-officielles/26-le-site-fait-peau-neuve/"><img src="{PATH_TO_ROOT}/templates/{THEME}/protoshow/img/1.jpg" alt="" /> </a> </li> <li class="slide" data-slide-interval=""> <a href="http://www.aufildariane.net/articles/17-autres-articles/36-grow-food-not-lawns/"><img src="{PATH_TO_ROOT}/templates/{THEME}/protoshow/img/2.jpg" alt="" /> </a> </li> <li class="slide" data-slide-interval=""> <a href="http://www.aufildariane.net/articles/17-autres-articles/28-delit-de-sale-gueule/"><img src="{PATH_TO_ROOT}/templates/{THEME}/protoshow/img/3.jpg" alt="" /> </a> </li> <li class="slide" data-slide-interval=""> <a href="http://www.aufildariane.net/articles/6-nourriture-pour-l-esprit/21-les-cafes-polyglottes/"><img src="{PATH_TO_ROOT}/templates/{THEME}/protoshow/img/4.jpg" alt="" /> </a> </li> <li class="slide" data-slide-interval=""> <a href="http://www.aufildariane.net/articles/16-sante/25-labels-biologiques/"><img src="{PATH_TO_ROOT}/templates/{THEME}/protoshow/img/5.jpg" alt="" /> </a> </li> <li class="slide" data-slide-interval=""> <a href="http://www.aufildariane.net/articles/16-sante/34-les-graisses-hydrogenees/"><img src="{PATH_TO_ROOT}/templates/{THEME}/protoshow/img/6.jpg" alt="" /> </a> </li> <li class="slide" data-slide-interval=""> <a href="http://www.aufildariane.net/articles/9-tutoriels-astuces/14-astuce-garder-vos-bouquets-fleuris-plus-longtemps/"><img src="{PATH_TO_ROOT}/templates/{THEME}/protoshow/img/7.jpg" alt="" /> </a> </li> </ul> </div> <br/> <div class="center"><img src="http://www.aufildariane.net/upload/divider_70b4a.png" alt=""></div> <br/> <div class="center"><img src="http://www.aufildariane.net/up-perso/last-recipes.png" alt=""></div> <br/> # INCLUDE RECETTES # <br/> <br/> # INCLUDE HYGIENE # <br/> <br/> # INCLUDE MODIF # <br/> <br/> # INCLUDE ESPRIT # <br/> <br/> # INCLUDE TUTOS # <br/> <br/> # INCLUDE DECO # <br/> <br/> # INCLUDE SANTE # <br/> <br/> # INCLUDE AUTRES # <br/> <table class="formatter-table"> <tbody><tr class="formatter-table-row"> <th class="formatter-table-head">Les 8 derniers messages postés sur le Forum:</th> </tr> <td class="formatter-table-col" style="text-align : left;">{FEED_FORUM} </td> </tbody></table>
Et voici mes fichiers autres.tpl ; deco.tpl ; esprit.tpl ; recettes.tpl ; tutos.tpl ; modif.tpl ; sante.tpl ; hygiene.tpl :
Caché :
Ils sont pour l'instant identique, j'en personnaliserai certains par la suite

Maintenant que tout ça est réglé, en plus d'éventuelles critiques ou remarques, je m'adresse au graphiste qui vient de me filer le coup de main du siècle (merci au passage !) pour mon problème de 25%.
J'ai une ligne de 4 articles récupérés avec leurs images, chacun devrait prendre 25% de la largeur de la page, mais si une image est inférieure à 25%, celles d'à côté prennent plus de place : http://prntscr.com/4tk0o6
Édité par Visiteur Le 06/10/2014 à 14h11
ElenWii Membre non connecté
-
Administrateur
- Voir le profil du membre ElenWii
- Inscrit le : 14/08/2009
- Site internet
- Groupes :
-
Equipe Graphique
Le code html :
Code TPL :
Le code CSS :
Code CSS :
.myelement-container { } .myelement { width: 25%; float: left; ou display:inline-block; }
Sinon tu peux aussi utiliser les flexbox si tu ne te soucis plus de IE8 et IE9.
Visiteur
Boosteur Inactif
ElenWii Membre non connecté
-
Administrateur
- Voir le profil du membre ElenWii
- Inscrit le : 14/08/2009
- Site internet
- Groupes :
-
Equipe Graphique
Répondre
Vous n'êtes pas autorisé à écrire dans cette catégorie