...

View Full Version : Newbie Array Help



aimerzz4
02-21-2008, 02:29 AM
I know this is a seriously dumb question, but I guess I have to ask sometime. I am trying to create arrays for a list of comic book issues I have collected.

For Example:


$axm = '<hr><p class="center"><b><a name="axm">Astonishing X-Men</a></b></p>
<p class="center">Astonishing X-Men #1<br><br>
Astonishing X-Men #2<br><br>
Astonishing X-Men #3<br><br>
Astonishing X-Men #4<br><br>
Astonishing X-Men #5<br><br>
Astonishing X-Men #6<br><br>
Astonishing X-Men #7<br><br>
Astonishing X-Men #8<br><br>
Astonishing X-Men #9<br><br>
Astonishing X-Men #10<br><br>
Astonishing X-Men #11<br><br>
Astonishing X-Men #12<br><br>
Astonishing X-Men #13<br><br>
Astonishing X-Men #14<br><br>
Astonishing X-Men #15<br><br>
Astonishing X-Men #16<br><br>
Astonishing X-Men #17<br><br>
Astonishing X-Men #18<br><br>
Astonishing X-Men #19<br><br>
Astonishing X-Men #20<br><br>
Astonishing X-Men #21<br><br>
Astonishing X-Men #22<br><br>
Astonishing X-Men #23<br><br>
Astonishing X-Men #24<br><br>Giant Sized Astonishing X-Men #1</p><br><br>';
$bp = '<hr><p class="center"><b><a name="bp">Black Panther</a></b></p><p class="center">
Black Panther #18<br><br>
Black Panther #22<br><br>
Black Panther #31</p><br><br>';
$cd = '<hr><p class="center"><b><a name="cd">Cable & Deadpool</a></b></p>
<p class="center">Cable & Deadpool #6<br><br>
Cable & Deadpool #7<br><br>
Cable & Deadpool #8<br><br>
Cable & Deadpool #9</p><br><br>';
I would like all of those issues turned into something such as $ongoing as well. I could echo the command $ongoing which would show all Astonishing X-Men, Black Panther, and Cable & Deadpool issues, but if I just wanted to show Astonishing X-Men, then I'd use $axm

Get what I mean?

So far, I have been trying this by basing off of this manual http://us2.php.net/function.array (at least I'm trying) :
<?php
$ongoing = array($axm, $bp, $cd =>);
print_r($ongoing);
?>


I dont' think that would work, but if anyone can get what I'm saying, thanks.

_Aerospace_Eng_
02-21-2008, 02:36 AM
Why do you have all that data inside of a variable when its just static? Why not just hard code the html into your page?

aimerzz4
02-21-2008, 02:39 AM
Why do you have all that data inside of a variable when its just static? Why not just hard code the html into your page?

Because I have the issue lists separated in alphabetical order and do not want to edit each page any time I add a new issue to the list.

I've been hoping to make the little PHP script a little more complex, so I can do more things to list I have, such as categorize it as ongoing title, miniseries, etc, through an echo like $ongoing or $miniseries.

Would also like a CMS so I can add issues through a login system instead of directly editing the issues. Don't know how I'll do THAT though. Will probably have to hire someone.

_Aerospace_Eng_
02-21-2008, 02:42 AM
You should probably look into a database then. Also you do know that you can use php includes? Create one file, upload it include it where you want it. If you need to add to it or rearrange stuff them then just again edit the one file, problem solved though if you intend on categorizing stuff I think you need a database.

aimerzz4
02-21-2008, 02:45 AM
You should probably look into a database then. Also you do know that you can use php includes? Create one file, upload it include it where you want it. If you need to add to it or rearrange stuff them then just again edit the one file, problem solved though if you intend on categorizing stuff I think you need a database.

That sounds like a good idea - using a database. Do you have any script recommendations for something like this?

(I have too many issues to rearrange and organize manually.)

Deacon Frost
02-21-2008, 02:53 AM
Might I recommend reading http://w3schools.com/php/php_arrays.asp . It teaches rather well about arrays and each kind to how they work. Scroll down to the bottom of the lesson where it says:

Multidimensional Arrays

I think that's what you're trying to achieve.

aimerzz4
02-21-2008, 03:32 AM
Right. I suck at math and don't really get this at all.

Anyone available for hire?



EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum