SitePoint Sponsor

User Tag List

Results 1 to 18 of 18
  1. #1
    SitePoint Wizard
    Join Date
    Jun 2005
    Posts
    1,416
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    PHP inlcudes into an auto colour chnaging table ?

    If you had a table, where, by js, css and crons, the table rows were auto changing colours (striped), and you wanted all of the rows of that table to be included from another website by PHP includes, how would you personally do it please? I have tried a few attempts at it, and when it's an ordinary table, the rows change colours with no problems, but as soon as you try to do PHP includes into it, the colouring isn't working! Any ideas how you get round that one please?

    Thanks.

    Dez.

  2. #2
    Keeper of the SFL StarLion's Avatar
    Join Date
    Feb 2006
    Location
    Atlanta, GA, USA
    Posts
    3,747
    Mentioned
    65 Post(s)
    Tagged
    0 Thread(s)
    I... am not following your description at all, i'm afraid. Is there an example you can show me? Or code?

  3. #3
    SitePoint Wizard
    Join Date
    Jun 2005
    Posts
    1,416
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    None at the moment, but just trying to see how this could be done really. you can auto change the colors of rows via css and js, but then, when you view a page that is as a result of php includes, the colors then go back to their original color.

    Basically, is there a way of having the tbody of a table coming from another website via a php include AND having some of the table rows automatically change their colors for the striping effect please?

    Any help appreciated.

    Dez

  4. #4
    Keeper of the SFL StarLion's Avatar
    Join Date
    Feb 2006
    Location
    Atlanta, GA, USA
    Posts
    3,747
    Mentioned
    65 Post(s)
    Tagged
    0 Thread(s)
    Javascript and PHP operate in two entirely different spheres, so using includes has no effect on javascript at all.

    Without having seen the code, theres not much we can suggest.

  5. #5
    SitePoint Wizard
    Join Date
    Jun 2005
    Posts
    1,416
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Using the zebra striping effect, it changes the table rows, but, if some of those table rows are coming in from another website, via a php include, it then loses the zebra affect.

    Just wondering if anyone here, especially those very familiar with the zebra effect have found a way to get round this?

  6. #6
    SitePoint Addict
    Join Date
    Dec 2005
    Posts
    336
    Mentioned
    1 Post(s)
    Tagged
    0 Thread(s)
    Perhaps something from the include has a similar id/class that could disrupt your js/css. Another guess since nothing else has been provided.

  7. #7
    SitePoint Wizard
    Join Date
    Jun 2005
    Posts
    1,416
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Thanks, but no class's or id's are in the tbody. Anyone familiar with the zebra way of styling table rows here?

  8. #8
    Keeper of the SFL StarLion's Avatar
    Join Date
    Feb 2006
    Location
    Atlanta, GA, USA
    Posts
    3,747
    Mentioned
    65 Post(s)
    Tagged
    0 Thread(s)
    I'm just trying to figure out how it's so hard to give us a code sample?
    You've got the code, you said yourself you've done it. Show us it.

  9. #9
    SitePoint Wizard
    Join Date
    Jun 2005
    Posts
    1,416
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Then you obviously need to recheck the posts, I never said I had done it!

    Anyone familiar with the zebra way of styling table rows here?

  10. #10
    Keeper of the SFL StarLion's Avatar
    Join Date
    Feb 2006
    Location
    Atlanta, GA, USA
    Posts
    3,747
    Mentioned
    65 Post(s)
    Tagged
    0 Thread(s)
    "None at the moment, but just trying to see how this could be done really. you can auto change the colors of rows via css and js, but then, when you view a page that is as a result of php includes, the colors then go back to their original color."

    Which... says to me "There exists a page which this code runs on"... because in order to know that it doesnt work, you have to have had a page in which it has done so.

    Unless you're just absolutely GUESSING that the page wont work, in which case you're asking about a problem you dont have.

    In either case, i'm done with this thread until you actually have a page you're trying to fix.

  11. #11
    SitePoint Wizard
    Join Date
    Jun 2005
    Posts
    1,416
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    You seem confused! I know from experience, that the zebra effect combined with php includes don't work, so am trying to see if anyone here knows of a way around it - quite simple really!

  12. #12
    Keeper of the SFL StarLion's Avatar
    Join Date
    Feb 2006
    Location
    Atlanta, GA, USA
    Posts
    3,747
    Mentioned
    65 Post(s)
    Tagged
    0 Thread(s)
    My point is - TRY IT YOURSELF FIRST. stop asking about a problem that you dont have because you havent tried it and gotten stuck on it. TRY it, and if it doesnt work, THEN come ask questions about why it doesnt work. You're assuming it's not going to work based on... seeing something sometime that you cant see the code to and are unable to reproduce.

    Assuming you're talking about standard js (and not AJAX), I can guarantee that the problem is NOT PHP. Period. They work in completely different runtimes. By the time JS sees the code, it's static HTML. Same as any other page in the world.

  13. #13
    It's all Geek to me silver trophybronze trophy
    ralph.m's Avatar
    Join Date
    Mar 2009
    Location
    Melbourne, AU
    Posts
    23,620
    Mentioned
    413 Post(s)
    Tagged
    7 Thread(s)
    Quote Originally Posted by Dez View Post
    I know from experience, that the zebra effect combined with php includes don't work
    As StarLion said, though, PHP operates on the server, so JS just sees the final product and operates on that, includes or not. So the JS zebra striping won't be affected by includes. Rather than assume you will have problems, just give it a go, and then if there are problems, we can look at why.

  14. #14
    SitePoint Wizard
    Join Date
    Jun 2005
    Posts
    1,416
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    My point is - IS THAT IT WOULDN'T WORK! I tried it a few years ago, and it just wouldn't! But, no worries, time to move on!

  15. #15
    SitePoint Wizard
    Join Date
    Jun 2005
    Posts
    1,416
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Thanks Ralph - best to leave this! Thanks anyway :thumbsup:

  16. #16
    Keeper of the SFL StarLion's Avatar
    Join Date
    Feb 2006
    Location
    Atlanta, GA, USA
    Posts
    3,747
    Mentioned
    65 Post(s)
    Tagged
    0 Thread(s)
    Quote Originally Posted by Dez View Post
    I never said I had done it!
    Quote Originally Posted by Dez View Post
    I tried it a few years ago, and it just wouldn't!
    ... nuff said.

  17. #17
    SitePoint Wizard
    Join Date
    Jun 2005
    Posts
    1,416
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    PHP includes into an auto colour changing table ?

    Have now found a solution - thank you to all those that were helpful!
    Last edited by AnthonySterling; Sep 15, 2011 at 10:07. Reason: thread merge

  18. #18
    Unobtrusively zen silver trophybronze trophy
    paul_wilkins's Avatar
    Join Date
    Jan 2007
    Location
    Christchurch, New Zealand
    Posts
    14,527
    Mentioned
    84 Post(s)
    Tagged
    4 Thread(s)
    Quote Originally Posted by Dez View Post
    Have now found a solution - thank you to all those that were helpful!
    Did the new solution involve using CSS instead?
    http://www.w3.org/Style/Examples/007/evenodd.en.html
    Programming Group Advisor
    Reference: JavaScript, Quirksmode Validate: HTML Validation, JSLint
    Car is to Carpet as Java is to JavaScript


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
  •