WordPress.org

Forums

Style issue with 'echo table' in get_calendar() (5 posts)

  1. pericat
    Member
    Posted 10 years ago #

    Found this while tracking down a CSS validation error. Line 365 of template-functions-general.php:
    echo '<table id="wp-calendar">
    This was actually causing a problem for me, since I was using a style sheet and index.php I'd been working with since before upgrading to 1.2, and in that index.php was a list member id'd as "wp-calendar" in the line above the call to get_calendar().
    It looks to me as this kind of thing (hiding CSS elements in code, even if they're not mentioned in the latest and greatest default style sheet) can lead to all sorts of odd glitches that can be difficult to track down. I changed the line to a simple "echo <table>" and let the

  2. above it, since it's IN the index.php file, handle the formatting, and maybe I did it right and maybe I didn't, but I stopped having weird changes in my calendar formats and the CSS validated afterward, so I'm okay for now.
  • Beel
    Member
    Posted 10 years ago #

    There are several instances where the "hiding" of css elements in the code is necessary, as with the generation of link categories. When upgrading if someone wishes to continue using an older style sheet and index page, as well as any other tweaked file, it is imperative that one compare them against the new files to check what needs to be tweaked in order to continue using them without problems. I don't recall what the old index page had for the li id but I figured there would be some significant changes since the upgrade went from 1.0.2 to 1.2.
    Glad you found the issue for you and perhaps your post will provide a heads up for others. Out of curiousity, why didn't you just change the id in your older index file and css since any future updates will require you to again change the code?

  • pericat
    Member
    Posted 10 years ago #

    I think a better approach is the one taken with #menu, where the initial declaration is in index.php, and when underlying elements are passed in by the called functions, they come in without any hard-coded style settings themselves, but instead take their style info via cascade, from settings in the stylesheet such as '#menu ul', '#menu ul li', etc.
    You say, "When upgrading if someone wishes to continue using an older style sheet and index page..."
    With respect, that's not an "if". People with established sites will not only wish to continue using their existing index and stylesheet files, they will expect to do so, and many will expect to do so without knowing a blessed thing about how the PHP part works, just which calls to type in to get their sidebars and content sections and so on out of the database and onto the screen. So I think retaining the statement as echo <table id="wp-calendar">; may serve to build in an unnecessary support issue, since many do expect style assignments to be made out in the open, and will design their templates as though that were the case.
    You rightly point out that my changing the functions file means that future upgrades will break my index; but as it stands, the current upgrade broke (okay, bent) my index, so I'm kind of seeing this as a six of one dilemma.
    This all sounds as though I'm saying, 'you people did this wrong!' and that's not what I mean at all. It's just me saying how things looked from where I sat last night, not being particularly familiar with WP, or indeed dynamically generated html. If that's useful to anyone, great, if not... :)
    And when it comes down to it, it took me no more than five minutes to see where the CSS conflict originated, and since you've kindly confirmed that the echo statement in the functions file is a deliberate choice, I'll factor that in when I get around to adjusting my temporary quick-fix solution into a more permanent one.

  • Beel
    Member
    Posted 10 years ago #

    Well, this is certainly the place to bring up issues. I have seen many suggestions incorporated, some rather quickly. However "deliberate" certain choices are doesn't mean those choices are necessarily permanent. I just noticed the index template changed again in the CVS today so I am off to see how that might affect my page ;-)...

  • pericat
    Member
    Posted 10 years ago #

    another one? oh, lordy, I've got to start keeping up with this stuff better.

  • Topic Closed

    This topic has been closed to new replies.

    About this Topic

    Tags

    No tags yet.