Lassie Posted November 20, 2009 Share Posted November 20, 2009 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. Quote Link to comment https://forums.phpfreaks.com/topic/182268-problem-with-directory-levels/ Share on other sites More sharing options...
rajivgonsalves Posted November 20, 2009 Share Posted November 20, 2009 are you getting any errors ? Quote Link to comment https://forums.phpfreaks.com/topic/182268-problem-with-directory-levels/#findComment-961800 Share on other sites More sharing options...
Lassie Posted November 20, 2009 Author Share Posted November 20, 2009 No, no errors. Just failed to open the path to the functions. Quote Link to comment https://forums.phpfreaks.com/topic/182268-problem-with-directory-levels/#findComment-961823 Share on other sites More sharing options...
rajivgonsalves Posted November 20, 2009 Share Posted November 20, 2009 should this <?php require('..../wordpress/wp-load.php');?> be <?php require('../../wordpress/wp-load.php');?> not too sure if it will solve your problems but its worth a try Quote Link to comment https://forums.phpfreaks.com/topic/182268-problem-with-directory-levels/#findComment-961826 Share on other sites More sharing options...
Lassie Posted November 20, 2009 Author Share Posted November 20, 2009 AFRAID NOT. I HAVE PUT DETAILS PAGE UP SO U CAN SEE ERROR Quote Link to comment https://forums.phpfreaks.com/topic/182268-problem-with-directory-levels/#findComment-961836 Share on other sites More sharing options...
rajivgonsalves Posted November 20, 2009 Share Posted November 20, 2009 I don't see any errors on the link provided above Quote Link to comment https://forums.phpfreaks.com/topic/182268-problem-with-directory-levels/#findComment-961840 Share on other sites More sharing options...
Lassie Posted November 20, 2009 Author Share Posted November 20, 2009 Sorry, I mean the file not found message. To be clear you need to go to the publisher page and click Feed. In safari or IE this will give a list. Read More is the link.Thanks also for your help Quote Link to comment https://forums.phpfreaks.com/topic/182268-problem-with-directory-levels/#findComment-961991 Share on other sites More sharing options...
rajivgonsalves Posted November 20, 2009 Share Posted November 20, 2009 how is the file included in the generate...php file (the feed generator ? Quote Link to comment https://forums.phpfreaks.com/topic/182268-problem-with-directory-levels/#findComment-961997 Share on other sites More sharing options...
mikesta707 Posted November 20, 2009 Share Posted November 20, 2009 Why don't you just use the absolute URL as opposed to the relative one? Quote Link to comment https://forums.phpfreaks.com/topic/182268-problem-with-directory-levels/#findComment-961999 Share on other sites More sharing options...
Lassie Posted November 20, 2009 Author Share Posted November 20, 2009 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(); } ?> Quote Link to comment https://forums.phpfreaks.com/topic/182268-problem-with-directory-levels/#findComment-962012 Share on other sites More sharing options...
mikesta707 Posted November 20, 2009 Share Posted November 20, 2009 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 Quote Link to comment https://forums.phpfreaks.com/topic/182268-problem-with-directory-levels/#findComment-962017 Share on other sites More sharing options...
Lassie Posted November 20, 2009 Author Share Posted November 20, 2009 To Be clear the message I get with an absolute url is URL file-access is disabled in the server configuration.... I presume this is a security measure. Quote Link to comment https://forums.phpfreaks.com/topic/182268-problem-with-directory-levels/#findComment-962023 Share on other sites More sharing options...
mikesta707 Posted November 20, 2009 Share Posted November 20, 2009 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 Quote Link to comment https://forums.phpfreaks.com/topic/182268-problem-with-directory-levels/#findComment-962036 Share on other sites More sharing options...
Lassie Posted November 20, 2009 Author Share Posted November 20, 2009 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 Quote Link to comment https://forums.phpfreaks.com/topic/182268-problem-with-directory-levels/#findComment-962055 Share on other sites More sharing options...
mikesta707 Posted November 20, 2009 Share Posted November 20, 2009 and the page you want to load is wordpress/wp-load.php right? well that is 4 directories back, so ../../../../wp-load might do it. Quote Link to comment https://forums.phpfreaks.com/topic/182268-problem-with-directory-levels/#findComment-962063 Share on other sites More sharing options...
Lassie Posted November 20, 2009 Author Share Posted November 20, 2009 yes wordpress/wp-load.php is the file. Tried it locally and get the same error. I will update the server. Quote Link to comment https://forums.phpfreaks.com/topic/182268-problem-with-directory-levels/#findComment-962067 Share on other sites More sharing options...
Lassie Posted November 20, 2009 Author Share Posted November 20, 2009 Still not loading. Is the fact that the link is in the page opened by the browser for the feed an issue? Quote Link to comment https://forums.phpfreaks.com/topic/182268-problem-with-directory-levels/#findComment-962071 Share on other sites More sharing options...
mikesta707 Posted November 20, 2009 Share Posted November 20, 2009 hmm maybe try 5 ../, and make sure that you have the right directory seperator. if its windows it may have to be ..\ rather than ../ Quote Link to comment https://forums.phpfreaks.com/topic/182268-problem-with-directory-levels/#findComment-962073 Share on other sites More sharing options...
Lassie Posted November 20, 2009 Author Share Posted November 20, 2009 I am afraid that didnt work or the \. I tried 4/ and 5/ and 4\and5\. I have to break for the timebeing. Thank you so much for your help. If anything else occurs to u perhaps u could let me know in due coourse. rgds Lassie Quote Link to comment https://forums.phpfreaks.com/topic/182268-problem-with-directory-levels/#findComment-962077 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.