PDA

View Full Version : PHP help... newsPHP



nataku
June 11th, 2002, 18:05
I've been working with this newsPHP script for a couple hours now and now matter what I do with it it's not working in my site. Everything is set up right because I could go to the admin panel and set all the options I wanted. But when I put this line of code where I want my news to appear and then upload my page, I get nothing.



<?php include ("nphp/news.txt"); ?>


I've renamed my file to .php instead of .html, is there anything else I need to do? Or should it be working?

I made a few test pages with PHP code in them and put them on my host, project-linux.org, to see if their PHP was down, and they work just fine... so I can't seem to find the problem. I really know nothing about PHP, so I'm not the best to troubleshoot this stuff. I heard this news script was supposed to be extremely easy to install, too.

Oh yeah, I already looked on their site for help. They only have a four question FAQ that didn't help and their forums are down.

Thanks for any help you have.

Christopher
June 11th, 2002, 18:11
I don't think there is supposed to be a space there...


include("yourfile.txt");

No space between the include and parenthesis. Try it.

agent007
June 11th, 2002, 18:12
The space doesn't matter. ;)

The only thing I can suggest is make sure you have installed nPHP in the correct folder. :p

Christopher
June 11th, 2002, 18:20
Heh, I learned something today also! Thanx agent007!

To what extent does "the space doesn't matter" go to? Could I do something like: my_function ("variable"); ?

In short: Does it apply for all functions?

agent007
June 11th, 2002, 18:40
Originally posted by Christopher
Heh, I learned something today also! Thanx agent007!

To what extent does "the space doesn't matter" go to? Could I do something like: my_function ("variable"); ?

In short: Does it apply for all functions?

:)

I'm not sure about the extent, but I do know that include("something.inc");, and include ("something.inc"); do exactly the same thing. The space just makes it looker a bit neater and less cluttered, I guess. Also, if you define a variable, you can, but don't have to, put spaces before and after the "=" sign. Ex:



<?
$variable = "asdf";
?>


and



<?
$variable="asdf";
?>


are the same. It doesn't make any difference. :)

nataku
June 11th, 2002, 18:55
Hmm... everything checks out... maybe it's just not meant to work on my host...

nag
June 12th, 2002, 03:17
<?php include ("nphp/news.txt"); ?>

I think you are missing "/" in it I have not seen this structure anywhere try this...

<?php include ("/nphp/news.txt"); ?>

or try <?php require("/nphp/news.txt"); ?>
You can include any file with any extension
i.e
file.php
file.inc
file.htm
or even...
file.nat :p
Also space DOES not matter and PHP is called as Free Format language like C so you can write your whole script in a single line like


echo "my name is php "; echo "I am an interesting language";print("I am a free format language");echo "You are using $HTTP_USER_AGENT ";

PHP interpreter just ignores the spaces....:p