The new forums will be named Coin Return (based on the most recent vote)! You can check on the status and timeline of the transition to the new forums here.
The Guiding Principles and New Rules document is now in effect.

Failing at PHP

darleysamdarleysam On my way toUKRegistered User regular
edited April 2010 in Help / Advice Forum
It's been a long time since I did any web design, and what I know is very basic, rudimentary stuff, and so it stands to reason that I'm completely stumped at the moment. I'm building a website for my band and using Wordpress to manage all the content, posting both news updates and gigs and having the PHP separate them out and post them in separate iframes (yes there'll be a neater way to do it, no I don't know what it is). The problem I've got is that I want to use the same 'gig' posts on two separate pages, formatted differently. As in, on the front page just have a list of the headings in a small font, then on another page the complete entry with more details in a bigger font. It's reusing the same CSS tags across both pages (checking the source on the site confirms this) even though the page has different commands. Is there something I can easily drop in to fix this?

forumsig.png
darleysam on

Posts

  • NightslyrNightslyr Registered User regular
    edited April 2010
    Can you look under the hood and see exactly how the different commands/functions are displaying the output? Are they calling other functions to handle the output, or just spewing HTML + CSS directly to the page?

    Nightslyr on
  • flatlinegraphicsflatlinegraphics Registered User regular
    edited April 2010
    there should be a chunk of php that calls the database for the posts. wrap them in a div with different class names.
    ex:
    <div class="onetypeofpost">
    <?php 
    //code that gets the posts
    ?>
    </div>
    
    <div class="othertypeofpost">
    <?php 
    //code that gets the posts
    ?>
    </div>
    

    the php call will be the same, but from a DOM standpoint, they will be different.
    you can then referece
    .onetypeofpost .postitem1 {border:1px solid red}
    .othertypeofpost .postitem1{border:1px solid blue}

    if this is wordpress, you may have to dig into the /theme/ directory to find out where these things are. they can be in different places depending on the theme.

    and no, iframes are not your answer. they are never the answer.
    <?php include('path/to/file.php');?> is what you want.

    flatlinegraphics on
  • darleysamdarleysam On my way to UKRegistered User regular
    edited April 2010
    Just dropped out one iframe to test the php include, and it works fine to pull the content in, but it seems to screw up the html for the table it's going into..

    edit: no, wait, fixed it in part. I'd just been sloppier than usual. Still not got the class-name tags working right yet, but I'll post my code up in a bit so you can see what I'm doing wrong.

    edit 2: okay, seems like getting the includes working neatly has helped the problem from the start. Should hopefully be alright now.. thanks a lot guys!

    darleysam on
    forumsig.png
Sign In or Register to comment.