Adding to a post?

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
User avatar
William
Forum Contributor
Posts: 332
Joined: Sat Oct 25, 2003 4:03 am
Location: New York City

Adding to a post?

Post by William »

Now that i got it all set up! I cant figure out how to add to an array for posting and how tyo make it go to the top. So ti will kep the new posts at the top :-(. Here is my code for the posts:

Code: Select all

<?php
$posts = array ( 
array ( "
<table width=75% border=0>
<tr> 
<td><font color=00FF00>BREAKING THE HABIT....NEXT SINGLE</font></td>
</tr>
<tr> 
<td bgcolor=00CC00>
<p>
<font color=000000>
Today during the LP chat Chester said himself that Breaking the habit will be the next single. This is 
a quote from the chat - 
</p>11/27/2003
<p>
CHAZrocks - What is your next single? Did you know 
Lars was going to come on stage and chase you around? Is it true you never 
sleep? And hi, LP rocks.
</p>
<p>
Chester - Yes i rarely sleep. No i didn't know 
Lars was going to do that. The next single is Breaking the habit.</p>
<p>
You all may not know Mike Shinodas words saying 
that BTH will never be a single, in this case Warner brothers got to choose.
</p>
<p>The video shoot will be in December!</font>
</p>
</td>
</tr>
<tr> 
<td align=right bgcolor=00CC00>&nbsp;<font color=000000>Posted 
by&nbsp;&nbsp;<a href=mailto:hybrid_dj@hotmail.com class=post>hybrid-soldier</a></font></td>
</tr>
</table>" ),
array ( "
<p>&nbsp;</p>
<table width=75% border=0>
<tr> 
<td><font color=00FF00>LP Up For Song Of The Year!!</font></td>
</tr>
<tr> 
<td bgcolor=00CC00>
<font color=000000>
Somewhere I Belong is nominated 
for Song Of The Year for Launch's 2003 Music Awards. 
<p>
Here are the rest of the nominees:<br>
In Da Club - 50 Cent<br>
Crazy In Love - Beyonce<br>
Bring Me To Life - Evanescence<br>
Get Busy - Sean Paul </p>
<p>
You can vote for LP here:&nbsp;&nbsp;[<a href=http://home.php>Launch.com</a>]
</p>
</font>
</td>
</tr>
<tr> 
<td align=right bgcolor=00CC00>&nbsp;<font color=000000>Posted 
by&nbsp;&nbsp;<a href=mailto:hybrid_dj@hotmail.com class=post>hybrid-soldier</a></font></td>
</tr>
</table>
" ),
array ( "
<p>&nbsp;</p>
<table width=75% border=0>
<tr> 
<td><font color=00FF00>Joe Hahns movie idea</font></td>
</tr>
<tr> 
<td bgcolor=00CC00>
<font color=000000>
<img src=0312890729.M.jpg name=newsimage width=92 height=140 hspace=5 vspace=5 border=0 align=right id=newsimage>
Hahn got the right to a favourite book of his called "King Rat" he has 1 year to make the scripts and get organized for movie filming. On tuesday on MOJO radio am 730 Brad and Joe were being interviewed on loveline. By request i could record the tape onto the my computer and upload it for a free download.
</font>
</td>
</tr>
<tr> 
<td align=right bgcolor=00CC00>&nbsp;<font color=000000>Posted 
by&nbsp;&nbsp;<a href=mailto:hybrid_dj@hotmail.com class=post>hybrid-soldier</a></font></td>
</tr>
</table>
" ),
array ( "
<p>&nbsp;</p>
<table width=75% border=0>
<tr> 
<td><font color=00FF00>WATCH FROM THE INSIDE</font></td>
</tr>
<tr> 
<td bgcolor=00CC00>
<font color=000000>
<h2>It's on the videos page!</h2>
</font>
</td>
</tr>
<tr> 
<td align=right bgcolor=00CC00>&nbsp;<font color=000000>Posted 
by&nbsp;&nbsp;<a href=mailto:hybrid_dj@hotmail.com class=post>hybrid-soldier</a></font></td>
</tr>
</table>
"),
array ( "
<p>&nbsp;</p>
<table width=75% border=0>
<tr> 
<td><font color=00FF00>From The Inside Download</font></td>
</tr>
<tr> 
<td bgcolor=00CC00>
<font color=000000>
You can *legally* download LP's new video <a href=http://www.7digitalmedia.com/downloads/linkin/location.asp>HERE</a> for about $2.00 
</font>
</td>
</tr>
<tr> 
<td align=right bgcolor=00CC00>&nbsp;<font color=000000>Posted 
by&nbsp;&nbsp;<a href=mailto:hybrid_dj@hotmail.com class=post>hybrid-soldier</a></font></td>
</tr>
</table>
" ),
array ( "
<p>&nbsp;</p>
<table width=75% border=0>
<tr> 
<td><font color=00FF00>Live in Texas Player</font></td>
</tr>
<tr> 
<td bgcolor=00CC00>
<font color=000000>
Brand new player from the one and only Linkin Park<br /><a href=http://www.bandbuilder.com/lptexas/index.php?ref_code=D30503>Click Here</a>
</font>
</td>
</tr>
<tr> 
<td align=right bgcolor=00CC00>&nbsp;<font color=000000>Posted 
by&nbsp;&nbsp;<a href=mailto:hybrid_dj@hotmail.com class=post>hybrid-soldier</a></font></td>
</tr>
</table>
" ),
array ( "
<p>&nbsp;</p>
<table width=75% border=0>
<tr> 
<td><font color=00FF00>Videos</font></td>
</tr>
<tr> 
<td bgcolor=00CC00>
<font color=000000>
Check Out the videos page. If you have a request for a video e-mail me and I will Upload it.
</font>
</td>
</tr>
<tr> 
<td align=right bgcolor=00CC00>&nbsp;<font color=000000>Posted 
by&nbsp;&nbsp;<a href=mailto:hybrid_dj@hotmail.com class=post>hybrid-soldier</a></font></td>
</tr>
</table>
" ),
array ( "
<p>&nbsp;</p>
<table width=75% border=0>
<tr> 
<td><font color=00FF00>Back And Better Than Ever</font></td>
</tr>
<tr> 
<td bgcolor=00CC00>
<font color=000000>
Hybrid Soldier Is Back!!! E-mail your comments 
</font>
</td>
</tr>
<tr> 
<td align=right bgcolor=00CC00>&nbsp;<font color=000000>Posted 
by&nbsp;&nbsp;<a href=mailto:hybrid_dj@hotmail.com class=post>hybrid-soldier</a></font></td>
</tr>
</table>
" )
);
?>
Now how whould i add a post to that? With user input it has to add more tables to that post! And has to eb at the top of it all any dieas thanks.
Joan Garnet
Forum Newbie
Posts: 19
Joined: Fri Jun 20, 2003 9:56 am
Location: Barcelona

Post by Joan Garnet »

You can use:
<a name="anything">
in each post begining, and then you can go there by using:
<a href="mi_page.php#anything">

I think they call it anchor ( not sure.... )
bye!
User avatar
William
Forum Contributor
Posts: 332
Joined: Sat Oct 25, 2003 4:03 am
Location: New York City

hmm

Post by William »

it has to add to a array using some array ag i udnerstand that but hwo can i make it add to an array?
Joan Garnet
Forum Newbie
Posts: 19
Joined: Fri Jun 20, 2003 9:56 am
Location: Barcelona

Post by Joan Garnet »

you can use the index of the array, or if you are using a database you can use the id of the row.

I guess you are using a foreach, so well here is an example:

Code: Select all

$i = 0;
foreach ( $posts as $news ) 
{ 
	foreach ( $news as $news2 )
	{
	  print "<a name=". $i ."><a/>$news2<br />"; 
	  $i++;
	}
} 
echo "<p><a href=" . $_SERVER["PHP_SELF"] . "#1>go to the 1st post</a>";
User avatar
William
Forum Contributor
Posts: 332
Joined: Sat Oct 25, 2003 4:03 am
Location: New York City

hehe

Post by William »

So sorry frogot this little bit of information. You know website that use html tables to make posts ont he firstb page for liek ewns on site .ect? Well its got to post new at the top. It isnt pages tehms elf its like lots of tabls like a ladder each bar is another new3s and i nead a code toa dd to the ladder AKA array of post codes. If this is to complicated i can explain more in other words i got an array thats has lots of arrays inside of it each of tha arrays ionsdie of that have the htmlt able code. Then on the main apge im using the incldue function to incldue that array now i nead a form to sned data to my adddb.php witch then uses valubles to add the post the way he wants it. So it ahs to add an array and it has to add to the top. Wow even im confused after this post hehe
Joan Garnet
Forum Newbie
Posts: 19
Joined: Fri Jun 20, 2003 9:56 am
Location: Barcelona

Post by Joan Garnet »

me too :D
User avatar
William
Forum Contributor
Posts: 332
Joined: Sat Oct 25, 2003 4:03 am
Location: New York City

LOL

Post by William »

hmm... I want it to post tables on a page with who tis psoted by i want it to be done ina rrays and i nead him to be able to add it with forms. Any ideas?
Joan Garnet
Forum Newbie
Posts: 19
Joined: Fri Jun 20, 2003 9:56 am
Location: Barcelona

Post by Joan Garnet »

Does it come from a database ??
or it's just a text file ??
How does it work...
User avatar
William
Forum Contributor
Posts: 332
Joined: Sat Oct 25, 2003 4:03 am
Location: New York City

Um

Post by William »

Text file with lots of arrays in it i psotrd it above lol its the BIG one
Joan Garnet
Forum Newbie
Posts: 19
Joined: Fri Jun 20, 2003 9:56 am
Location: Barcelona

Post by Joan Garnet »

If the page looks exactly like that just save it as a .php page and include it. Then you can use the code I posted above.

bye !
Post Reply