Trying to use MyThreads links manager to update links on our front page without having to directly edit the code.

Here is the page we're trying to include on the home page: http://www.ealantamagazine.com/links/index.php3?category=1

and here is the home page:
http://www.ealantamagazine.com/.

Notice that the original page shows up but the area where it's suppose to appear on the home page only shows this message:

Warning: require(./lib/phplib/template.inc) [function.require]: failed to open stream: No such file or directory in /home/natura44/public_html/ealantamagazine.com/links/index.php3 on line 16

Warning: require(./lib/phplib/template.inc) [function.require]: failed to open stream: No such file or directory in /home/natura44/public_html/ealantamagazine.com/links/index.php3 on line 16

Fatal error: require() [function.require]: Failed opening required './lib/phplib/template.inc' (include_path='.:/usr/lib/php:/usr/local/lib/php') in /home/natura44/public_html/ealantamagazine.com/links/index.php3 on line 16

What's wrong? And is there a better way to do this?

It cannot find this file:
/home/natura44/public_html/ealantamagazine.com/links/lib/phplib/template.inc

I realize that, but the question is why when the file does exist? It finds it when you visit "/links/index.php3?category=1", but when I try to require "/links/index.php3?category=1" on the home page of the site I get the error message.

Because the current folder there is different. Try using an absolute path instead of a relative one.

pritaeas, thanks.

I changed the file paths in the folder I was requiring from, but after I eliminated all error messages I just got a blank space where the links were supposed to show up. So, I:

- changed the template for the original page containing the links to that it looked exactly like the home page with the links where I want them
- moved the files from the folder I was requiring from into the same directory as the home page so that my modified links page became the home page
- added "<? ob_start(); ?>" at the beginning of the home page code and "<? ob_flush(); ?>" at the end (I don't know why, but I saw it in a forum and it helped my problem)
- added "$HTTP_GET_VARS["category"] = '1'" to the home page code so that the web address is ourdomain.com instead of ourdomain.com?category=1

It works great!

For the record, I'm now using

<?php  require_once ($_SERVER['DOCUMENT_ROOT'] . '/file.php')  ?>

instead of

<?php  require_once dirname(__FILE__) . '/file.php' ?>

which I was using before. So far, it works more smoothly.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.