SitePoint Sponsor

User Tag List

Results 1 to 4 of 4
  1. #1
    SitePoint Enthusiast nisha's Avatar
    Join Date
    Dec 2007
    Posts
    40
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Question error occuring in php page

    hi,

    I am not wellversed with php, but still try to work on php projects such as word press blog which can be easily done. so this time i have worked on one such blog and everything was working fine till yesterday.

    but yesterday client said he wants the about us page to open when the user
    visits the site and then when the home page link is clicked the current index page should appear.

    so i just changed the names of the too files i.e. index.php to home.php and the about.html file to index.html and uploaded the files again changing the links in the header file as well.

    so this time when i checked the site the index page works fine as required, but the home.php file shows some fatal error as under

    Fatal error: Call to undefined function get_header() in /home/workingt/public_html/home.php on line 1
    this says that header file should be included in the line 1 of the home.php
    but i have already done that in my code and before changing the names it was working fine so now what happened to the header function please have a look in to the matter soon.

    here is the code of the home.php page :

    PHP Code:
    <?php get_header(); ?>
    <?php get_sidebar
    (); ?>
    <style type="text/css">
    <!--
    body {
        background-image:  url(images/wallpaper1.jpg);
    }
    -->
    </style>
    <div id="contentcontainer">

    <?php if ( have_posts() ) : while ( have_posts() ) : the_post(); ?>

    <div class="blogbefore"></div>
    <div class="blog"><div style="overflow: hidden;">
    <h3><a href="<?php the_permalink(); ?>" title="Permalink for <?php the_title(); ?>"><?php the_title(); ?></a></h3>
    <p class="headertext">Posted on <?php the_time('F jS, Y'); ?> by <?php the_author(); ?><?php edit_post_link('edit.'); ?><br />Categories: <?php the_category(', '?>.</p>
    <?php the_content(); ?>
    <?php 
    if(!is_single()) { ?><p class="footertext"><?php comments_popup_link('0 comments.''1 comment.''% comments.' ); ?></p><? } else { ?><p class="footertext"><?php comments_number(__('0 comments.'), __('1 comment.'), __('% comments.')); ?></p><?php ?>
    </div></div>
    <div class="blogafter"></div>

    <?php comments_template(); ?>

    <?php endwhile; else:  ?>

    <div class="blogbefore"></div>
    <div class="blog">
    <h3>There are no blogs relating to your query.</h3>
    </div>
    <div class="blogafter"></div>

    <?php endif; ?>

    <?php if(!is_single()) { ?>
    <div class="blogbefore"></div>
    <div class="blog"><div style="overflow: hidden;">
    <p>
    <span class="right"><?php posts_nav_link('','','Older &raquo;'?></span>
    <span class="left"><?php posts_nav_link('','&laquo; Newer',''?></span>
    </p>
    <p class="clear"></p>
    </div></div>
    <div class="blogafter"></div>

    <?php } else {} ?>

    </div>

    <?php get_footer(); ?>
    Help appreciated.

  2. #2
    Use The Cloud
    Join Date
    Jan 2006
    Location
    Boise, ID
    Posts
    556
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    You don't need to code any PHP to make those changes.

    WordPress has all of that functionality built directly into the administrative panel. You can add pages and their content, as well as choose which page should be displayed by default.
    Brad Hanson, Web Applications & Scalability Specialist
    ► Is your website outgrowing its current hosting solution?
    ► PM me for a FREE scalability consult!
    ► USA Based: Available by Phone, Skype, AIM, and E-mail.

  3. #3
    SitePoint Enthusiast nisha's Avatar
    Join Date
    Dec 2007
    Posts
    40
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    hey thanks bhanson for the quick reply, but now when i have done the changes how can i solve this error. Also i am aware of the fact that wordpress themes can be changed from the admin and also the link to the pages and i have tried it from their also.

    Still this error is occurring. so what is the solution to it. I feel some silly thing is missing just if i get that it will be done. so please have a look in to my code and suggest me if i can solve that fatal error.

    Help Appreciated.

  4. #4
    Use The Cloud
    Join Date
    Jan 2006
    Location
    Boise, ID
    Posts
    556
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    The thing is, you cannot just move files around in an application manually without having extensive knowledge about its architecture.

    In this case, I believe WordPress routes all requests through index.php so moving it and expecting the application to work is unreasonable. The easiest solution to your problem is to move the files back and use the built in functionality. Creating a page is very trivial in the admin panel.
    Brad Hanson, Web Applications & Scalability Specialist
    ► Is your website outgrowing its current hosting solution?
    ► PM me for a FREE scalability consult!
    ► USA Based: Available by Phone, Skype, AIM, and E-mail.


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
  •