Page 1 of 1

Hide HTML Tag's with PHP event(solved)

Posted: Mon May 11, 2009 4:41 pm
by Cakey
So I just cannot seem to figure this out. Maybe I am attacking it wrong.

I tried using an if statement and an Echo, and it displayed everything very skewed and wouldn't use my inner PHP functions. So I am at a loss of ideas.

Code: Select all

 
<?php 
    if( is_in_market() ){
        ?>
<div class="col1">
    <p>Search for a item:</p>
    <form style="margin-bottom:0;margin:0;" method="get" action="<?php echo $_SERVER['PHP_SELF']; ?>">
      <input class="postform" type="text" name="s" value="Search for something" onfocus="this.value='',this.style.backgroundColor='#fff'" onblur="this.style.backgroundColor='#fff'" size="42" id="search_input" />
      <input type="image" src="<?php bloginfo('template_directory'); ?>/imgs/sf.png" value="Search" alt="Search" title="Search" />
    </form>
  </div>
        <?php
    }
?>
The idea is if the php function returns true then to display the following form and let it function.

could I just use the Include function, and put the HTML form stuff in a separate file?

Any ideas peoples? :o


----
Edit:
Using the Include function seems to solve this.

Re: Hide HTML Tag's with PHP event(solved)

Posted: Mon May 11, 2009 6:55 pm
by ldougherty
Your code works fine for me.. Ofcourse I had to remove the function reference since it doesn't exist on my test page.

I replaced this

if( is_in_market() ){

With

if( 1==1 ){

And the script works fine.

If it's not working for you and you're not getting any errors you likely don't have PHP errors enabled. Try adjusting your if statement to match mine and see if that works to eliminate your function call.