that can read this INFO.INI and pull the info from ex MOBILE into a string called $MOBILE and then create a HTML code containing this info..
ex:
<?php
/some code to get the the MOBILE info from the INFO.INI
echo "<font color=red>" . $MOBILE . "</font>" ;
?>
something like this.. can anyone help me out a little..
hope you guys get what i mean, kinda hard to explain..
Thanks in advance...for any help regarding this.,..
(Cause i have a few domains like www.hfa.no and www.forbruksartikler.no where im to remake a webshops preview system into something quite simpler, but i cant really figure out how to make PHP read from a file this way, but i know that it is possible,cause i've seen it be done other places...)
Last edited by alexdata; Jun 11th, 2005 at 10:12 PM.
Reason: Adding Info..
*************** Please use [highlight=vb]..your code.. [/highlight] when posting code!
When you have received the working answer to your question,
please mark it as *SOLVED* + Your Questions Title ...using your Thread's Tool menu.
Also try to point out what answer made it work for you, or edit your first post to contain a quote of the correct answer...
Please Answer All Questions With Working Code Examples...
Re: How to read a specific line from a file? using php..
hi, im not having a go at you or anything but i asked this kinf of question a few days ago and why put "using php.." at the end of your title when it is in the PHP forum. here is my thread i asked a few days ago http://www.vbforums.com/showthread.php?t=342531. it should help. you could change the code to use math to do with the number of lines and all the other things in between it or something.
If there is only one perfect person in the universe, does that make them imperfect?
Re: How to read a specific line from a file? using php..
Thanks, alacritous.. Your code worked exellent!!
I modified it to my needs and now i can have it "build" the content of a website from a single textfile.. so i can edit the textfile easily, and keep the site's design intact without ruinin anything.. very handy...
Thanks alot,..
DanDono.. I read your thread, but that didnt really suit my needs.. so therefore i asked the question again.. in a slightly different way, and i wrote USING PHP, because i know many would tend to answer in any other languages they know.. happened to me in the VB part of this forum, that i got answers using java, or c, or php... so thats why... hehe, but thanks for your thread, gave out some other handy info...
I uploaded two files for people who wants to try this out right away.. its a PHP and a TXT file.. upload both to your server and open the PHP one.. now it will build a HTML site from the text in the InFO.txt.. edit the txt file and your HTML site will be easily reddesigned in the same style..
PS: rename the "AutoFiller.php.txt" to something like "AutoFill.php" or "index.php"
Last edited by alexdata; Jun 11th, 2005 at 10:23 PM.
*************** Please use [highlight=vb]..your code.. [/highlight] when posting code!
When you have received the working answer to your question,
please mark it as *SOLVED* + Your Questions Title ...using your Thread's Tool menu.
Also try to point out what answer made it work for you, or edit your first post to contain a quote of the correct answer...
Please Answer All Questions With Working Code Examples...
Re: [resolved] How to read a specific line from a file? using php..
Also used this and same result:
<?PHP
$lines = file('2010/ligas.txt');
$l_count = count($lines);
for($x = 0; $x< $l_count; $x++)
{
}
include ("$dic2010"."$lines[2]");
?>
where $lines[2] is the 3th line on the ligas.txt file... and that’s the online it reads, if I add a 4th line in the ligas file it will read the 4th line as long as it's the last in the list and called bye $lines last line.
Re: [resolved] How to read a specific line from a file? using php..
first, that code you have there doesn't make much sense. you have a for loop that loops through the lines in the file, but you're not doing anything in the for loop. you need to change the code to the following:
if you see what I've changed, now instead of referencing $lines[2], I'm referencing $lines[$i], which is the current line index of the loop. if you're getting errors still about files not existing, then the file doesn't exist. PHP uses a relative path from the file being run for includes, so if your path goes to /includes/somefile.php, then the /includes/ folder needs to exist in the same directory that the PHP file being run exists in (presumably index.php).
Re: [resolved] How to read a specific line from a file? using php..
you said it didn't work -- now, does it work? there isn't anything wrong with the code I posted. you have to make sure the files you reference in ligas.txt exist and $dic2010 is defined somewhere.
what do you mean, how do you separate files? as soon as the file is included, it will be executed. if the file is simply printing content out, then that content will be printed out as if it existed in the current file. if you want something else to be output every time you include a file, you would do that inside of the for loop:
PHP Code:
for( ... ){
// Place a horizontal rule echo '<hr />';
include( ... );
// Print a message echo 'That was file #' . ($i + 1);
}
in this example, a horizontal rule will be placed before each file's contents. then, after the content, it will display a message saying which file was just printed (starting at 1).