a custum template

  • LadGalen

    #4063

    Hi,

    First I would like to said that I am not a master of php and html.

    Before I discovered graphene I used Zee Display theme. I simply did a custom page by copying an existing page****.php file and insert a peace of code. It is several php lines which print a list of files in a directory which are available to download.

    Thus the page template looked like this :

    <?php
    /*
    Template Name: Page Download
    */
    ?>
    <?php get_header(); ?>

    <div id="content" class="fullwidth">

    <div id="page-<?php the_ID(); ?>" <?php post_class(); ?>>

    <h2><?php the_title(); ?></h2>

    <div class="entry">
    <?
    $listeDossier = array( "./doc", "./code", "./python", "./fortran", "./makefile", "./latex", "./tikz");

    // affiche les differents dossiers
    echo "<h3>Catégories</h3>n";
    echo "
    <ul>n";
    foreach($listeDossier as $dossier) {
    echo '
    <li><a href="#' . $dossier . '">' . $dossier . "</a></li>
    n";
    }
    echo "</ul>
    n";

    // parcours les dossier pour afficher les fichiers qu'ils contiennent
    foreach($listeDossier as $dossier) {

    // separateur
    echo "<hr />n";

    // affiche le nom du dossier
    if($dossier == "./doc") {
    echo '<div class="goto_top"><a href="#wrapper">haut de la page</a></div>' . "n";
    echo '<h3 id="' . $dossier . '"> Documents :</h3>' . "n";
    } else {
    echo '<div class="goto_top"><a href="#wrapper">haut de la page</a></div>' . "n";
    echo '<h3 id="' . $dossier . '"> Fichiers : ' . str_replace( "./", "", $dossier) . "</h3>n";
    }

    // lecture du contenu du dossier
    if($opendossier = opendir($dossier)) {
    while(false !== ($fichier = readdir($opendossier))) {
    if($fichier != "." && $fichier != "..") {

    // emplacement du fichier
    $pathfile = $dossier . "/" . $fichier;

    // associe la bonne classe au type de fichier
    if( preg_match("#.pdf$#", $fichier )) {
    echo '<a href="' . $pathfile . '">' . $fichier . '</a>' ;
    } elseif( preg_match("#.c$#", $fichier )) {
    echo '<a href="' . $pathfile . '">' . $fichier . '</a>' ;
    } elseif( preg_match("#.tex$#", $fichier )) {
    echo '<a href="' . $pathfile . '">' . $fichier . '</a>' ;
    } elseif( preg_match("#.tar.gz$#", $fichier )) {
    echo '<a href="' . $pathfile . '">' . $fichier . '</a>' ;
    } elseif( preg_match("#.zip$#", $fichier )) {
    echo '<a href="' . $pathfile . '">' . $fichier . '</a>' ;
    } elseif( preg_match("#.f90$#", $fichier )) {
    echo '<a href="' . $pathfile . '">' . $fichier . '</a>' ;
    } elseif( preg_match("#.py$#", $fichier )) {
    echo '<a href="' . $pathfile . '">' . $fichier . '</a>' ;
    } elseif( preg_match("#^makefile#i", $fichier )) {
    echo '<a href="' . $pathfile . '">' . $fichier . '</a>' ;
    } else {
    echo '<a href="' . $pathfile . '">' . $fichier . '</a>' ;
    }
    echo "n";
    }
    }

    // fermeture
    closedir($opendossier);

    } else {
    echo "impossible de lire le dossier";
    }
    }
    ?>
    <div class="clear"></div>
    </div>
    </div>
    </div>

    <?php get_footer(); ?>

    Then, now, I would like to have the same page template with graphene. As you can imagine, I simply copied the template-oneocolumn.php file and I put my php code inside.

    I can now use my template, my php code works but the list is outside the frame of the page. See here http://http://gvallver.perso.univ-pau.fr/?page_id=135

    Can somebody help me to do that please ?

    Thanks

    Mod

    Kenneth John Odle

    #27086

    Try changing

    <div class="entry">

    to

    <div class="entry-content clearfix">

    Not tested, but worth a shot.

    LadGalen

    #27087

    Hi,

    It is better but it does not completely fix it. The background is still lacking.

    Germain

Viewing 3 posts - 1 through 3 (of 3 total)

You must be logged in to reply to this topic.