Jump to content

Recommended Posts

I am developing a site based on wordpress.

I have witten an RSS program that displays a list of recent uploads from authors.

Each has a link back to a wordpress page that takes the book id and displays the details of the author and work.

The problem is that when the link is clicked the wordpress page gives an error undefined function call (the first call is get_header() ).

I thought the problem might be that the wp functions were not within scope, although all the folders and files are within the wordpress folder, so I put a line in to include the wp-load.php on the display details page.

I cant get this to work though.

The display page is as follows


<?php
/*
Template Name: detail
*/
?>
<?php require('..../wordpress/wp-load.php');?>
<?php get_header();?>
<div id="leftnav">
<?php include(TEMPLATEPATH . '/sidebar1.php');?>


<div id="right_pan">
</div>
</div>

<div id="rightnav">
<?php include (TEMPLATEPATH . '/sidebar3.php');?>
</div>

<div id="content">
<div class="roundedcornr_box_908360">
   <div class="roundedcornr_top_908360"><div></div></div>
      <div class="roundedcornr_content_908360">
      
<p><img src="http://localhost/wordpress/wp-content/themes/custom1/images/video016.gif"/>
New Author Submissions</p>


<?php

This is a link to a version on a server that doesnt have this display page but shows the link from the publisher page to show the RSS

http://217.46.159.229/wordpress/

Any help appreciated.

Link to comment
https://forums.phpfreaks.com/topic/182268-problem-with-directory-levels/
Share on other sites

The RSS generator file is below.

I tried absolute path and it gives url file access denied in the server.

I have the RSS files in a folder in the custom1 theme i am developing.

The path is http://217.46.159.229/wordpress/wp-content/themes/custom1/ch9_exercises/generate_rss_06.php

This is the message from clicking the link.

 

Warning: require(../../wordpress/wp-load.php) [function.require]: failed to open stream: No such file or directory in W:\www\wordpress\wp-content\themes\custom1\detail.php on line 6

 

Fatal error: require() [function.require]: Failed opening required '../../wordpress/wp-load.php' (include_path='.;/usr/local/PHP/includes;/usr/local/PHP/pear;/home/admin/www/plugins/pear/PEAR') in W:\www\wordpress\wp-content\themes\custom1\detail.php on line 6

 

The generator file

<?php
require_once '../Pos/RssFeed.php';
require_once '../Pos/MysqlImprovedConnection.php';
require_once '../Pos/MysqlImprovedResult.php';




try {
  $xml = new Pos_RssFeed('localhost', 'root', 'root', 'ab');
  $xml->setFeedTitle('Authorbank New Submissions');
  $xml->setFeedLink('http://www.example.com/oop_news.xml');
  $xml->setFeedDescription('New Authors and New writing for Publishers.');
  $xml->setLastBuildDate(true);
  // $xml->setFilePath('oop_news.xml');
  $xml->setItemTitle('WorkingTitle');
  $xml->setItemDescription('BriefDescription');
  $xml->setItemPubDate('updated');
  $xml->setTable('book');
  $xml->setItemLinkURL('http://localhost/wordpress/wp-content/themes/custom1/detail.php');
//  $xml->setItemLink('url');
  $result = $xml->generateXML();
  if ($result) {
   header('Content-Type: text/xml');
    echo $result;
  }
  else {
    echo 'Error';
  }
}
catch (Exception $e) {
  echo $e->getMessage();
}

?> 

 

if that directory doesn't have the permission to open the file, it won't be able to open the file regardless of what type of path you use (relative or absolute)

 

You will need to set the file permissions for that directory so that it has access to the other directory

this usually means that the allow_url_fopen option in your php.ini is set to off. This means you can't use absolute URLs in your include files. To remedy this, you can just turn it on. However, this is a security concern if you allow user's to upload stuff, and your security measures are poor.

 

 

What is exact URL for the page you wish to include, and the exact url for the page you wish to include it from. Also remember that if you need to go up in a directory, for every folder you go up, you need to add a ../ for example if you wish to go two folders up you need to do ../../twoFoldersUp. if its three, do ../../../threeFoldersUp

 

Right I follow u.

The url from the link is

http://217.46.159.229/wordpress/wp-content/themes/custom1/detail.php?BookID=14

This is generated from the Feed link on the publisher page

The feed url is

feed://217.46.159.229/wordpress/wp-content/themes/custom1/ch9_exercises/generate_rss_06.php

 

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.