LinuxQuestions.org
Welcome to the most active Linux Forum on the web.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Non-*NIX Forums > Programming
User Name
Password
Programming This forum is for all programming questions.
The question does not have to be directly related to Linux and any language is fair game.

Notices


Reply
  Search this Thread
Old 12-19-2005, 01:10 PM   #1
windisch
Member
 
Registered: Nov 2004
Location: Gahanna, Ohio, USA
Distribution: Fedora 9
Posts: 158

Rep: Reputation: 30
Question How to create a list with PHP/HTML


I have a streaming radio website/request system, which was helped mostly by the great people here at LQ. I created a page that shows the request file (a simple text file). But the text displays like this:
song1song2song3......

What would be the easiest way to have it formatted like this?

song1
song2
song3

Or better yet?

1. Song1
2. Song2
3. Song3

Thanks,
Adam Windisch
 
Old 12-19-2005, 01:14 PM   #2
titanium_geek
Senior Member
 
Registered: May 2002
Location: Horsham Australia
Distribution: elementary os 5.1
Posts: 2,479

Rep: Reputation: 50
Sorry, not a php guru, but I do know my way around html. the code for a bulleted list is
<ul><li>song1</li>
<li>song2</li></ul>

which should give you
* song1
* song2
(it is indented)

simly change ul to ol for a numbered list.
 
Old 12-19-2005, 01:19 PM   #3
windisch
Member
 
Registered: Nov 2004
Location: Gahanna, Ohio, USA
Distribution: Fedora 9
Posts: 158

Original Poster
Rep: Reputation: 30
I should clear this up. This is a text file that is changed on the fly, with user requests. I just want to use PHP to open the file and list it. Is what you described above the way to go?
 
Old 12-19-2005, 01:33 PM   #4
paulsm4
LQ Guru
 
Registered: Mar 2004
Distribution: SusE 8.2
Posts: 5,863
Blog Entries: 1

Rep: Reputation: Disabled
An HTML table is what you're looking for. It's easily generated by PHP (for example, use PHP to query a mySQL database, and write the resulting db rows/columns into an HTML table):

HTML example:
Code:
<table border="2">
  <tr>
    <th>Composer</th><th>Title</th></tr>
  <tr>
    <td>Beatles</th><th>Abbey Road</th></tr>
  <tr>
    <td>Bach</th><th>Two and Three Part Inventions</th></tr>
</table>
This example might be overkill (you might not need or want Pear:B, for example), but it should point you in the right general direction:

http://www.kitebird.com/articles/peardb.html
<= In your case, you'd just "fopen()" the file and parse it a line at a time with PHP.
You'd bracket each line with a matching "<tr>...</tr>", and each column with a "</td>..</td>".

Last edited by paulsm4; 12-19-2005 at 01:41 PM.
 
  


Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
date drop down list HTML ? ALInux Programming 3 11-09-2005 05:52 AM
html into php charnel Programming 7 08-30-2005 10:47 AM
PHP/html forum FedoraUsr Programming 2 08-18-2005 01:07 PM
Script or Simple App to Create HTML Table Populated With Images infidel Linux - Software 14 06-07-2005 01:08 AM
html to php? help me please!!!!! trscookie Programming 4 01-24-2005 06:36 AM

LinuxQuestions.org > Forums > Non-*NIX Forums > Programming

All times are GMT -5. The time now is 12:27 PM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration