SitePoint Sponsor

User Tag List

Results 1 to 5 of 5

Thread: Phpbb loops

Hybrid View

  1. #1
    SitePoint Enthusiast
    Join Date
    Apr 2012
    Posts
    96
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Phpbb loops

    Hello, trying to create a loops statement in phpbb, but when it appears in html on the site, some of the content is missing, for example, here is the code:

    PHP Code:
    <!-- BEGIN anime -->
             <
    div class="anime">
             <!-- IF 
    BEGIN img -->
            {
    anime.img.IMG}
             <!-- ENDIF -->
                <
    h2>{anime.ANIME_NAME}</h2>
                <
    p>{anime.ANIME_DESC}</p>
            </
    div>
            <!-- 
    END anime --> 
    and heres the result:

    PHP Code:
    <div>
             
            <
    img src="images/anime_shows//Guilty_Crown.jpg" alt="Guilty_Crown.jpg" width="80px;" height="100px" />
             
                <
    h2></h2>
                <
    p></p>
            </
    div>
            
             <
    div>
             
            <
    img src="images/anime_shows//Oh_My_Goddess.jpg" alt="Oh_My_Goddess.jpg" width="80px;" height="100px" />
             
                <
    h2></h2>
                <
    p></p>
            </
    div>
            
             <
    div>
             
                <
    h2>Ai Yori Aoshi</h2>
                <
    p>Kaoru Hanabishia college student who lives alonemet a beautiful but bewildered girl dressed in kimono at train stationHe volunteered to guide her way to the address she was looking for, which looked like in his neighborhood but turned out to be an empty lotNot knowing what to do nextKaoru invited the devastated girl to his apartment and asked for additional clue -- a photo with two children whom Kaoru immediately identified as himself and Aoi Sakurabahis childhood friendIt turned out that the girl in front of him is Aoi Sakuraba herselfhis betrothed fiancée who came all the way to Tokyo to marry himHer revelation was not only surprising but also reminded the deepest part of Kaoru's memory for why he left the Hanabishi family in the first place.</p>
            </div>
            
             <div>
             
                <h2>Oh My Goddess!</h2>
                <p>Keiichi Morisato is a good-natured, yet hapless and girlfriend-less college sophomore who is often imposed upon by his elder dorm-mates and brow-beaten into taking phone messages and doing other chores for them. One day, while alone in his dorm, he accidentally calls the Goddess Technical Help Line and a beautiful goddess named Belldandy materializes in his room. She tells him that her agency has received a system request from him, so she has been sent to grant him a single wish. Skeptical and thinking someone is playing a practical joke on him, he wishes that she stay with him forever. To his surprise, his wish is granted. Belldandy must stay with him, but as his dormitory is strictly male-only, they are both forced onto the street. They set off on his motorcycle to find alternative shelter, eventually seeking cover in an old Buddhist temple. In the morning, they are greeted by the temple'
    s sole inhabitanta young monkwho welcomes them and gives them permission to stay until they c</p>
            </
    div>
            
             <
    div>
             
                <
    h2>Guilty Crown</h2>
                <
    p>After the spread of the "Apocalypse Virus" in Japan in the year 2029the country has been placed in an emergency stateSince the spread of the virusthe Japanese government lost all of its foundations, and the reign of the international organization known as GHQ began ruling the countryNow Japan is in a state of martial lawwhich is enforced by the GHQ, and is considered a "quasi-independent" nation.  10 years pass, and we see the story through the eyes of Shu Oumaan average 17-year-old teenager who lives a normal lifeHoweverhis normal life style is soon shattered after his chance encounter with Inori Yuzurihawho eventually involves him with the anti-government group she is a part ofknown as Funeral Parlor, or Undertaker.</p>
            </
    div>
            
             <
    div>
             
                <
    h2></h2>
                <
    p></p>
            </
    div>
            </
    div

  2. #2
    SitePoint Wizard bronze trophy chris.upjohn's Avatar
    Join Date
    Apr 2010
    Location
    Melbourne, AU
    Posts
    2,183
    Mentioned
    17 Post(s)
    Tagged
    1 Thread(s)
    Could you please post the actual PHP template code that controls the loop values as the template HTML doesn't help us to help you.
    Blog/Portfolio | Evolution Xtreme | DFG Design | DFG Hosting | CSS-Tricks | Stack Overflow | Paul Irish
    Having lame problems with your code? Let us help by using a jsFiddle

  3. #3
    SitePoint Enthusiast
    Join Date
    Apr 2012
    Posts
    96
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Sorry bout that, here it is:

    PHP Code:
    $dir =            'images/anime_shows/';
    $file_display = array('jpg''jpeg''png''gif');


    if (
    file_exists($dir) == false
    {
    echo 
    'Folder \''$dir'\' not found!';

        else 
        {
        
    $dir_contents scandir($dir);

            foreach (
    $dir_contents as $file
            {
            
    $file_type strtolower(end(explode('.'$file)));
                
                    if (
    $file !== '.' && $file !== '..' && in_array($file_type$file_display) == true
                    {
                    
    $animeimg '<img src="' $dir '/' $file '" alt="' $file '" width="80px;" height="100px" />';
                    
                    
    $template->assign_block_vars('anime.img', array(
                        
    'IMG'    => $animeimg,
                        ));
                    }
            }
        }

    $sql "SELECT name, description FROM phpbb_anime" ;
    $result $db->sql_query($sql);

    while (
    $row $db->sql_fetchrow($result))
    {
        
    $template->assign_block_vars('anime', array(
            
    'ANIME_NAME'    => $row['name'],
            
    'ANIME_DESC'    => $row['description'],
        ));


  4. #4
    SitePoint Wizard bronze trophy chris.upjohn's Avatar
    Join Date
    Apr 2010
    Location
    Melbourne, AU
    Posts
    2,183
    Mentioned
    17 Post(s)
    Tagged
    1 Thread(s)
    I'm a little confused as to why your creating a separate block array to store the anime images as you can't start one loop then attempt to intercept another, the only way to do what you want would be to include the IMG index within your MySQL while loop.
    Blog/Portfolio | Evolution Xtreme | DFG Design | DFG Hosting | CSS-Tricks | Stack Overflow | Paul Irish
    Having lame problems with your code? Let us help by using a jsFiddle

  5. #5
    SitePoint Enthusiast
    Join Date
    Apr 2012
    Posts
    96
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Sorry, I'm only a beginner at PHP, so what exactly is the IMG index? (feeling so stupid right now)


Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •