Results 1 to 9 of 9

Thread: Wierd ie6 problem with "if else" statement

  1. #1
    Join Date
    Sep 2008

    Wierd ie6 problem with "if else" statement

    Hi, is it just me who has stared my self blind on some little problem or why isnt this working correctly. Im trying to show different content on my wordpress pages with the if else statement, which works perfectly fine in firefox, but somehow it seems my ie6 doesent understand not to include the sidebar on my front page. This is my code:
    <?php get_header(); ?>
    	<div id="content" class="widecolumn">
    <?php if ( is_front_page() ) { ?> 
    <?php  } else { ?>
    <div class="leftblock">
    		<?php if (have_posts()) : while (have_posts()) : the_post(); ?>
    		<div class="post" id="post-<?php the_ID(); ?>">
    		<h2><?php the_title(); ?></h2>
    			<div class="entry">
    				<?php the_content('<p class="serif">Read the rest of this page &raquo;</p>'); ?>
    				<?php wp_link_pages(array('before' => '<p><strong>Pages:</strong> ', 'after' => '</p>', 'next_or_number' => 'number')); ?>
    		<?php endwhile; endif; ?>
    	<?php edit_post_link('Edit this entry.', '<p>', '</p>'); ?>
    <?php /* php get_sidebar(); */ ?>
    <div id="sidebar">
    <?php if ( !function_exists('dynamic_sidebar')
    || !dynamic_sidebar('sidebar1') ) : ?>
    <?php endif; ?>
    <?php } ?>
    Can you figgure out what i have done wrong? :S

    Thank you very much!

  2. #2
    Join Date
    Nov 2008
    PHP is executed on the server before anything is sent to the browser so it's unlikely to be a PHP issue. I'd take a look at the generated HTML and the related CSS, that's the usual culprit with IE woes.

  3. #3
    Join Date
    Sep 2008
    ok, i have tried that but i cant figgure it out, the website is http://mayslesinstitute.org/blog

  4. #4
    Join Date
    Aug 2004
    Since the PHP code is run on the server and not on the browser; if you are getting a different result on different browsers, then my first guess is that it's simply a case of the browser displaying a cached page. This might be solved simply by doing a page refresh in the browser. If that's not the case, then the only other thing I can think of based on the limited info at hand is that there is something in the code we're not seeing that is dependent upon something sent (or not sent) by the browser. (For instance, what does the is_front_page() function do?)
    "Well done....Consciousness to sarcasm in five seconds!" ~ Terry Pratchett, Night Watch

    How to Ask Questions the Smart Way (not affiliated with this site, but well worth reading)

    My Blog
    cwrBlog: simple, no-database PHP blogging framework

  5. #5
    Join Date
    Sep 2008
    is a wordpress statement that listents for weather it is the "page" called frontpage.

    The thing im seeing now, because i also used the same "if else" in the header that loads the content of the "imgheader" div is also different in the two browsers.

  6. #6
    Join Date
    Sep 2008
    but just to be sure, ie6 and firefox and all other browsers for that matter, reads php exactly the same right?

  7. #7
    Join Date
    Nov 2008
    It's not a case of a browser reading php, the browser has no knowledge of php at all. All php code is run on the server and the result (usually some (X)HTML as in this case) is sent to the browser. Whatever the browser, it gets the exact same thing from the server as every other browser (usually, but lets not go there ).

  8. #8
    Join Date
    Aug 2004
    Browsers do not read PHP at all. All the PHP processing gets done on the server, and all any browser sees are the results of whatever the server processes and sends to the client (browser).

    If two browsers are showing different results for the exact same page request from the same host, then either there is something about the [X]HTML being output to them that is either invalid (causing each browser to make its best guess at what to do or else ignore it) or at least one of them is displaying a result from a cached page it retrieved before you made your more recent changes. A third but probably less likely situation in this case is that some part of your script depends upon something sent in one of the HTTP request headers sent by the browser and is causing some different logical path to be followed. This could possibly be the case if some part of the PHP script depends on a $_SERVER['HTTP_<something>'] value.

    I would therefore first try clearing each browser's cache to see if that clears things up. If not, do a "view source" on each to see if they are both getting the same exact output. and perhaps run that output through the HTML validator and then CSS validator to see if perhaps some invalid mark-up is confusing the browsers.
    "Well done....Consciousness to sarcasm in five seconds!" ~ Terry Pratchett, Night Watch

    How to Ask Questions the Smart Way (not affiliated with this site, but well worth reading)

    My Blog
    cwrBlog: simple, no-database PHP blogging framework

  9. #9
    Join Date
    Sep 2008
    Problem solved!
    I found out today that the fact that i had chosen a static homepage for the wordpress template and then chosen not to publish that page (so it wouldnt show in my menu) caused wordpress to sometimes grab the right page, and firefox would then cache it, and other times wordpress wouldnt catch the right page which caused the different pages showing up!
    lol, but when i chosed to make that static page in wordpress "public" everything worked out.
    Thanks for your help guys!

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Tags for this Thread

Posting Permissions

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



X vBulletin 4.2.2 Debug Information

  • Page Generation 0.10809 seconds
  • Memory Usage 2,935KB
  • Queries Executed 15 (?)
More Information
Template Usage (33):
  • (1)ad_footer_end
  • (1)ad_footer_start
  • (1)ad_global_above_footer
  • (1)ad_global_below_navbar
  • (1)ad_global_header1
  • (1)ad_global_header2
  • (1)ad_navbar_below
  • (1)ad_showthread_firstpost_sig
  • (1)ad_showthread_firstpost_start
  • (1)ad_thread_first_post_content
  • (1)ad_thread_last_post_content
  • (1)bbcode_code
  • (1)footer
  • (1)forumjump
  • (1)forumrules
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (1)headinclude_bottom
  • (9)memberaction_dropdown
  • (1)navbar
  • (4)navbar_link
  • (1)navbar_moderation
  • (1)navbar_noticebit
  • (1)navbar_tabs
  • (2)option
  • (9)postbit
  • (9)postbit_onlinestatus
  • (9)postbit_wrapper
  • (1)spacer_close
  • (1)spacer_open
  • (1)tagbit_wrapper 

Phrase Groups Available (6):
  • global
  • inlinemod
  • postbit
  • posting
  • reputationlevel
  • showthread
Included Files (26):
  • ./showthread.php
  • ./global.php
  • ./includes/class_bootstrap.php
  • ./includes/init.php
  • ./includes/class_core.php
  • ./includes/config.php
  • ./includes/functions.php
  • ./includes/functions_navigation.php
  • ./includes/class_friendly_url.php
  • ./includes/class_hook.php
  • ./includes/class_bootstrap_framework.php
  • ./vb/vb.php
  • ./vb/phrase.php
  • ./includes/functions_facebook.php
  • ./includes/functions_calendar.php
  • ./includes/functions_bigthree.php
  • ./includes/class_postbit.php
  • ./includes/class_bbcode.php
  • ./includes/functions_reputation.php
  • ./includes/functions_notice.php
  • ./packages/vbattach/attach.php
  • ./vb/types.php
  • ./vb/cache.php
  • ./vb/cache/db.php
  • ./vb/cache/observer/db.php
  • ./vb/cache/observer.php 

Hooks Called (73):
  • init_startup
  • friendlyurl_resolve_class
  • init_startup_session_setup_start
  • database_pre_fetch_array
  • database_post_fetch_array
  • init_startup_session_setup_complete
  • global_bootstrap_init_start
  • global_bootstrap_init_complete
  • cache_permissions
  • fetch_postinfo_query
  • fetch_postinfo
  • fetch_threadinfo_query
  • fetch_threadinfo
  • fetch_foruminfo
  • load_show_variables
  • load_forum_show_variables
  • global_state_check
  • global_bootstrap_complete
  • global_start
  • style_fetch
  • global_setup_complete
  • showthread_start
  • showthread_getinfo
  • strip_bbcode
  • friendlyurl_clean_fragment
  • friendlyurl_geturl
  • forumjump
  • cache_templates
  • cache_templates_process
  • template_register_var
  • template_render_output
  • fetch_template_start
  • fetch_template_complete
  • parse_templates
  • fetch_musername
  • notices_check_start
  • notices_noticebit
  • process_templates_complete
  • friendlyurl_redirect_canonical
  • showthread_post_start
  • showthread_query_postids
  • showthread_query
  • bbcode_fetch_tags
  • bbcode_create
  • showthread_postbit_create
  • postbit_factory
  • postbit_display_start
  • postbit_imicons
  • bbcode_parse_start
  • bbcode_parse_complete_precache
  • bbcode_parse_complete
  • postbit_display_complete
  • memberaction_dropdown
  • tag_fetchbit
  • tag_fetchbit_complete
  • forumrules
  • navbits
  • navbits_complete
  • build_navigation_data
  • build_navigation_array
  • check_navigation_permission
  • process_navigation_links_start
  • process_navigation_links_complete
  • set_navigation_menu_element
  • build_navigation_menudata
  • build_navigation_listdata
  • build_navigation_list
  • set_navigation_tab_main
  • set_navigation_tab_fallback
  • navigation_tab_complete
  • fb_like_button
  • showthread_complete
  • page_templates