Is there a super simple way to generate text links from a flat file into a specific location on my website?
PHP Text Links
Started by mmcduffie1, Mar 18 2009 08:36 AM
7 replies to this topic
#1
Posted 18 March 2009 - 08:36 AM
|
|
|
#2
Guest_Jordan_*
Posted 18 March 2009 - 08:39 AM
Guest_Jordan_*
Yes, there is. How is the flat-file laid out?
#3
Posted 18 March 2009 - 09:11 AM
i would like to just lay it out as text like
<a href="blah blsh blah>Visit SomeWebsite</a>. Just basic links to texts or image ads.
#4
Posted 18 March 2009 - 09:28 AM
what's your source? where do you read the links from? database? text file?
__________________________________________
I study Information Systems at Karlstad University when I'm not on CodeCall
I study Information Systems at Karlstad University when I'm not on CodeCall
#5
Posted 18 March 2009 - 09:33 AM
the source will be a flat file in the same directory as the script like webaddress/files/adlist.txt
#6
Posted 18 March 2009 - 09:47 AM
I'm trying to get PHP to read the links from a text file and insert them into a section of my webpage. I want to do it this way so I can jst edit one file and change all the ads. Right now i'm just doing an include(). The include() works fine but at some point I may want to limit the amount of links I display so then I need to read the file into an array i think then ad code to show like only 10 links or 20. Does that make any sense? Right now I think I juts need php to read the file into an array i guess and then i need to create a function to add to the page where i want the links to be. I thought I knew how but it seems i do not and my files are at work. If all else fails I will post the code i am trying to get to work tomorrow when I get to my office.
#7
Posted 18 March 2009 - 10:31 AM
You need to read the contents of the file to a string using either file_get_contents or fopen. Then depending on how the data is stored in the file you have several options. You can use the csv functions, explode, or the serialize functions to get the data into an array.
Posted via CodeCall Mobile
Posted via CodeCall Mobile
#8
Posted 18 March 2009 - 11:28 AM
Thanks everyone. I think I have a clue now. :D


Sign In
Create Account

Back to top









