08-07-08, 10:55 PM
Newbie Coder
Join Date: Jun 2007
Posts: 30
Thanks: 0
Thanked 0 Times in 0 Posts
[SOLVED] help please
i am not sure if this is easier to do in HTML, CSS or a php script.
on my gallery pages (like this one here
http://www.animerealmz.net/VOL_gallery.php )
you will see a section on the bottom with links to other galleries on my site.
what i want to do is
1) have 3 or 4 links per row.
2) be in alphabetical order
3) and neater than they look now.
instead of bombarding anyone with ALL the codeing i use on my site i will just post up what i got now that deals with the section of my pages that need work.
this is part of the CSS i use for the overall looks of the site spificley the links for the gallery links in this case
ADDED AFTER POSTING changing the % to px doesn't help
this is the HTML used in the galleries.txt file being used for the links i wish to change.
and finally on the bottom of the gallery pages i use this PHP script to call the galleries.txt page.
if there is an easier way to do this i am open to new ideas
08-08-08, 05:21 AM
Community Liaison
Join Date: Dec 2006
Location: Tacoma, Washington USA
Posts: 3,454
Thanks: 0
Thanked 140 Times in 137 Posts
Try it like this:
galleries.php
PHP Code:
<style> .gallery_header { text-align:center; padding:25px; padding-bottom:0px; } .a_container { width:150px; text-align:left; } .center_td { text-align:center; width:25%; /* Adjust this value for width of display. */ } .h3_style { color:silver; font-family:arial; } </style><?php $array = array( array( "Card Captior Sakura" , "CCS_gallery.php" ), array( "Record Of Lodoss" , "LODOSS_gallery.php" ), array( "Gundam Wing" , "GW_gallery.php" ), array( "Sailor Moon" , "SM_gallery.php" ), array( "Tenchi" , "TEN_gallery.php" ), array( "Fushigi Yuugi" , "FY_gallery.php" ), array( "Evangelion" , "EVA_gallery.php" ), array( "Dragon Ball Series" , "DB_gallery.php" ), array( "Series Experament Lain" , "LAIN_gallery.php" ), array( "CowBoy Bebop" , "CB_gallery.php" ), array( "Trigun" , "TRI_gallery.php" ), array( "EscaFlowne" , "EF_gallery.php" ), array( "Yu Gi Oh" , "YUGI_gallery.php" ), array( "Macross" , "MAC_gallery.php" ), array( "Appleseed Series" , "AS_gallery.php" ), array( "Bleach" , "BLEACH_gallery.php" ), array( "Blue Seed" , "BSeed_gallery.php" ), array( "Death Note" , "DeathNote_gallery.php" ), array( "Naruto" , "NARUTO_gallery.php" ), array( "Robotech" , "OnePiece_gallery.php" ), array( "Yu Yu Hakusho" , "YYH_gallery.php" ) ); sort ( $array ); echo '<table width="100%" border="0" cellpadding=0 cellspacing=0><tr><td colspan=3 class="gallery_header"><br><HR color=silver><h3 class="h3_style">ARZ Home</h3><a href="http://www.animerealmz.net">Home</a><HR color=silver><h3 class="h3_style">My Gallery Pages</h3></td></tr>' ; for( $i = 0 ; $i < ceil ( count ( $array )/ 3 ); $i ++) { echo '<tr><td align="right"><div class="a_container"><a href="http://www.animerealmz.net/' . $array [ $i ][ 1 ]. '">' . $array [ $i ][ 0 ]. '</a></div></td>' ; if( $array [ $i + 7 ]){echo '<td class="center_td"><div class="a_container"><a href="http://www.animerealmz.net/' . $array [ $i + 7 ][ 1 ]. '">' . $array [ $i + 7 ][ 0 ]. '</a></div></td>' ;} if( $array [ $i + 14 ]){echo '<td align="left"><div class="a_container"><a href="http://www.animerealmz.net/' . $array [ $i + 14 ][ 1 ]. '">' . $array [ $i + 14 ][ 0 ]. '</a></div></td>' ;} echo '</tr>' ; } echo '</table>' ; ?>
__________________
Jerry Broughton
Last edited by job0107; 08-08-08 at 05:26 AM .
08-08-08, 06:02 AM
Community Liaison
Join Date: Dec 2006
Location: Tacoma, Washington USA
Posts: 3,454
Thanks: 0
Thanked 140 Times in 137 Posts
Actually this galleries.php will work a little better.
It will automatically adjust for different number of elements in $array.
galleries.php
PHP Code:
<style> .gallery_header { text-align:center; padding:25px; padding-bottom:0px; } .a_container { width:150px; text-align:left; } .center_td { text-align:center; width:25%; /* Adjust this value for width of display. */ } .h3_style { color:silver; font-family:arial; } </style><?php $array = array( array( "Card Captior Sakura" , "CCS_gallery.php" ), array( "Record Of Lodoss" , "LODOSS_gallery.php" ), array( "Gundam Wing" , "GW_gallery.php" ), array( "Sailor Moon" , "SM_gallery.php" ), array( "Tenchi" , "TEN_gallery.php" ), array( "Fushigi Yuugi" , "FY_gallery.php" ), array( "Evangelion" , "EVA_gallery.php" ), array( "Dragon Ball Series" , "DB_gallery.php" ), array( "Series Experament Lain" , "LAIN_gallery.php" ), array( "CowBoy Bebop" , "CB_gallery.php" ), array( "Trigun" , "TRI_gallery.php" ), array( "EscaFlowne" , "EF_gallery.php" ), array( "Yu Gi Oh" , "YUGI_gallery.php" ), array( "Macross" , "MAC_gallery.php" ), array( "Appleseed Series" , "AS_gallery.php" ), array( "Bleach" , "BLEACH_gallery.php" ), array( "Blue Seed" , "BSeed_gallery.php" ), array( "Death Note" , "DeathNote_gallery.php" ), array( "Naruto" , "NARUTO_gallery.php" ), array( "Robotech" , "OnePiece_gallery.php" ), array( "Yu Yu Hakusho" , "YYH_gallery.php" ) ); sort ( $array ); $rows = ceil ( count ( $array )/ 3 ); echo '<table width="100%" border="0" cellpadding="0" cellspacing="0"><tr><td colspan="3" class="gallery_header"><br /><HR color=silver><h3 class="h3_style">ARZ Home</h3><a href="http://www.animerealmz.net">Home</a><HR color=silver><h3 class="h3_style">My Gallery Pages</h3></td></tr>' ; for( $i = 0 ; $i < $rows ; $i ++) { echo '<tr><td align="right"><div class="a_container"><a href="http://www.animerealmz.net/' . $array [ $i ][ 1 ]. '">' . $array [ $i ][ 0 ]. '</a></div></td>' ; echo $td2 = $array [ $i + $rows ] ? '<td class="center_td"><div class="a_container"><a href="http://www.animerealmz.net/' . $array [ $i + $rows ][ 1 ]. '">' . $array [ $i + $rows ][ 0 ]. '</a></div></td>' : '<td></td>' ; echo $td3 = $array [ $i +( $rows * 2 )] ? '<td align="left"><div class="a_container"><a href="http://www.animerealmz.net/' . $array [ $i +( $rows * 2 )][ 1 ]. '">' . $array [ $i +( $rows * 2 )][ 0 ]. '</a></div></td>' : '<td></td>' ; echo '</tr>' ; } echo '</table>' ; ?>
Note: This program will not work correctly with less than 3 array elements in $array.
At current there are 21 array elements in $array.
__________________
Jerry Broughton
Last edited by job0107; 08-08-08 at 06:24 AM .
08-08-08, 06:46 AM
Community Liaison
Join Date: Dec 2006
Location: Tacoma, Washington USA
Posts: 3,454
Thanks: 0
Thanked 140 Times in 137 Posts
One more revision. I have fixed the code so it will work with any number of array elements in $array.
galleries.php
PHP Code:
<style> .gallery_header { text-align:center; padding:25px; padding-bottom:0px; } .a_container { width:150px; text-align:left; } .center_td { text-align:center; width:25%; /* Adjust this value for width of display. */ } .h3_style { color:silver; font-family:arial; } </style><?php $array = array( array( "Card Captior Sakura" , "CCS_gallery.php" ), array( "Record Of Lodoss" , "LODOSS_gallery.php" ), array( "Gundam Wing" , "GW_gallery.php" ), array( "Sailor Moon" , "SM_gallery.php" ), array( "Tenchi" , "TEN_gallery.php" ), array( "Fushigi Yuugi" , "FY_gallery.php" ), array( "Evangelion" , "EVA_gallery.php" ), array( "Dragon Ball Series" , "DB_gallery.php" ), array( "Series Experament Lain" , "LAIN_gallery.php" ), array( "CowBoy Bebop" , "CB_gallery.php" ), array( "Trigun" , "TRI_gallery.php" ), array( "EscaFlowne" , "EF_gallery.php" ), array( "Yu Gi Oh" , "YUGI_gallery.php" ), array( "Macross" , "MAC_gallery.php" ), array( "Appleseed Series" , "AS_gallery.php" ), array( "Bleach" , "BLEACH_gallery.php" ), array( "Blue Seed" , "BSeed_gallery.php" ), array( "Death Note" , "DeathNote_gallery.php" ), array( "Naruto" , "NARUTO_gallery.php" ), array( "Robotech" , "OnePiece_gallery.php" ), array( "Yu Yu Hakusho" , "YYH_gallery.php" ) ); sort ( $array ); $rows = ceil ( count ( $array )/ 3 ); echo '<table width="100%" border="0" cellpadding="0" cellspacing="0"><tr><td colspan="3" class="gallery_header"><br /><HR color=silver><h3 class="h3_style">ARZ Home</h3><a href="http://www.animerealmz.net">Home</a><HR color=silver><h3 class="h3_style">My Gallery Pages</h3></td></tr>' ; for( $i = 0 ; $i < $rows ; $i ++) { echo '<tr><td align="right"><div class="a_container"><a href="http://www.animerealmz.net/' . $array [ $i ][ 1 ]. '">' . $array [ $i ][ 0 ]. '</a></div></td>' ; echo $td2 = $array [ $i + $rows ] ? '<td class="center_td"><div class="a_container"><a href="http://www.animerealmz.net/' . $array [ $i + $rows ][ 1 ]. '">' . $array [ $i + $rows ][ 0 ]. '</a></div></td>' : '<td class="center_td"><div class="a_container"> </div></td>' ; echo $td3 = $array [ $i +( $rows * 2 )] ? '<td align="left"><div class="a_container"><a href="http://www.animerealmz.net/' . $array [ $i +( $rows * 2 )][ 1 ]. '">' . $array [ $i +( $rows * 2 )][ 0 ]. '</a></div></td>' : '<td><div class="a_container"> </div></td>' ; echo '</tr>' ; } echo '</table>' ; ?>
__________________
Jerry Broughton
08-10-08, 07:38 PM
Newbie Coder
Join Date: Jun 2007
Posts: 30
Thanks: 0
Thanked 0 Times in 0 Posts
thanks that works great
i just need to know where i edit the font size for the links and i am all set thanks ever so much
and is it possible to put spaces between the rows of links without rewriting the script ?
if not then just resizing the links will work great thanks
08-11-08, 12:30 AM
Community Liaison
Join Date: Dec 2006
Location: Tacoma, Washington USA
Posts: 3,454
Thanks: 0
Thanked 140 Times in 137 Posts
Quote:
Originally Posted by
Mike Anime
thanks that works great
i just need to know where i edit the font size for the links and i am all set thanks ever so much
and is it possible to put spaces between the rows of links without rewriting the script ?
if not then just resizing the links will work great thanks
Everything can be done in the class a_container.
See example:
CSS Code:
<style>
.gallery_header {
text-align :center ;
padding :25px;
padding-bottom :0px;
}
.a_container {
/* Adjust the width to match font size. */
/* 115 @ 12, 135 @ 14, 145 @ 16, 175 @ 18, 190 @ 20 */
width :175px;
font-size :18px;
/* Adjust width if add bold. */
/* 130 @ 12, 150 @ 14, 165 @ 16, 185 @ 18, 205 @ 20 */
/* font-weight:bold; */
text-align :left ;
padding-bottom :10px; /* Adjust this value to add spacing. */
}
.center_td {
text-align :center ;
width :30 %; /* Adjust this value for width of display. */
}
.h3_style {
color :silver ;
font-family :arial;
}
</style>
<?php
$array = array(
array( "Card Captior Sakura" ,"CCS_gallery.php" ) ,
array( "Record Of Lodoss" ,"LODOSS_gallery.php" ) ,
array( "Gundam Wing" ,"GW_gallery.php" ) ,
array( "Sailor Moon" ,"SM_gallery.php" ) ,
array( "Tenchi" ,"TEN_gallery.php" ) ,
array( "Fushigi Yuugi" ,"FY_gallery.php" ) ,
array( "Evangelion" ,"EVA_gallery.php" ) ,
array( "Dragon Ball Series" ,"DB_gallery.php" ) ,
array( "Series Experament Lain" ,"LAIN_gallery.php" ) ,
array( "CowBoy Bebop" ,"CB_gallery.php" ) ,
array( "Trigun" ,"TRI_gallery.php" ) ,
array( "EscaFlowne" ,"EF_gallery.php" ) ,
array( "Yu Gi Oh" ,"YUGI_gallery.php" ) ,
array( "Macross" ,"MAC_gallery.php" ) ,
array( "Appleseed Series" ,"AS_gallery.php" ) ,
array( "Bleach" ,"BLEACH_gallery.php" ) ,
array( "Blue Seed" ,"BSeed_gallery.php" ) ,
array( "Death Note" ,"DeathNote_gallery.php" ) ,
array( "Naruto" ,"NARUTO_gallery.php" ) ,
array( "Robotech" ,"OnePiece_gallery.php" ) ,
array( "Yu Yu Hakusho" ,"YYH_gallery.php" )
) ;
sort( $array) ;
$rows = ceil( count( $array) /3 ) ;
echo '<table width="100%" border="0" cellpadding="0" cellspacing="0"><tr><td colspan="3" class="gallery_header"><br /><HR color=silver><h3 class="h3_style">ARZ Home</h3><a href="http://www.animerealmz.net">Home</a><HR color=silver><h3 class="h3_style">My Gallery Pages</h3></td></tr>' ;
for( $i=0 ;$i<$rows;$i++)
{
echo '<tr><td align="right"><div class="a_container"><a href="http://www.animerealmz.net/' .$array[$i][1 ].'">' .$array[$i][0 ].'</a></div></td>' ;
echo $td2 = $array[$i+$rows] ? '<td class="center_td"><div class="a_container"><a href="http://www.animerealmz.net/' .$array[$i+$rows][1 ].'">' .$array[$i+$rows][0 ].'</a></div></td>' : '<td class="center_td"><div class="a_container"> </div></td>' ;
echo $td3 = $array[$i+( $rows*2 ) ] ? '<td align="left"><div class="a_container"><a href="http://www.animerealmz.net/' .$array[$i+( $rows*2 ) ][1 ].'">' .$array[$i+( $rows*2 ) ][0 ].'</a></div></td>' : '<td><div class="a_container"> </div></td>' ;
echo '</tr>' ;
}
echo '</table>' ;
?>
__________________
Jerry Broughton
08-11-08, 01:43 AM
Newbie Coder
Join Date: Jun 2007
Posts: 30
Thanks: 0
Thanked 0 Times in 0 Posts
Quote:
Originally Posted by
job0107
Everything can be done in the class a_container.
See example:
CSS Code:
<style>
.gallery_header {
text-align :center ;
padding :25px;
padding-bottom :0px;
}
.a_container {
/* Adjust the width to match font size. */
/* 115 @ 12, 135 @ 14, 145 @ 16, 175 @ 18, 190 @ 20 */
width :175px;
font-size :18px;
/* Adjust width if add bold. */
/* 130 @ 12, 150 @ 14, 165 @ 16, 185 @ 18, 205 @ 20 */
/* font-weight:bold; */
text-align :left ;
padding-bottom :10px; /* Adjust this value to add spacing. */
}
.center_td {
text-align :center ;
width :30 %; /* Adjust this value for width of display. */
}
.h3_style {
color :silver ;
font-family :arial;
}
</style>
<?php
$array = array(
array( "Card Captior Sakura" ,"CCS_gallery.php" ) ,
array( "Record Of Lodoss" ,"LODOSS_gallery.php" ) ,
array( "Gundam Wing" ,"GW_gallery.php" ) ,
array( "Sailor Moon" ,"SM_gallery.php" ) ,
array( "Tenchi" ,"TEN_gallery.php" ) ,
array( "Fushigi Yuugi" ,"FY_gallery.php" ) ,
array( "Evangelion" ,"EVA_gallery.php" ) ,
array( "Dragon Ball Series" ,"DB_gallery.php" ) ,
array( "Series Experament Lain" ,"LAIN_gallery.php" ) ,
array( "CowBoy Bebop" ,"CB_gallery.php" ) ,
array( "Trigun" ,"TRI_gallery.php" ) ,
array( "EscaFlowne" ,"EF_gallery.php" ) ,
array( "Yu Gi Oh" ,"YUGI_gallery.php" ) ,
array( "Macross" ,"MAC_gallery.php" ) ,
array( "Appleseed Series" ,"AS_gallery.php" ) ,
array( "Bleach" ,"BLEACH_gallery.php" ) ,
array( "Blue Seed" ,"BSeed_gallery.php" ) ,
array( "Death Note" ,"DeathNote_gallery.php" ) ,
array( "Naruto" ,"NARUTO_gallery.php" ) ,
array( "Robotech" ,"OnePiece_gallery.php" ) ,
array( "Yu Yu Hakusho" ,"YYH_gallery.php" )
) ;
sort( $array) ;
$rows = ceil( count( $array) /3 ) ;
echo '<table width="100%" border="0" cellpadding="0" cellspacing="0"><tr><td colspan="3" class="gallery_header"><br /><HR color=silver><h3 class="h3_style">ARZ Home</h3><a href="http://www.animerealmz.net">Home</a><HR color=silver><h3 class="h3_style">My Gallery Pages</h3></td></tr>' ;
for( $i=0 ;$i<$rows;$i++)
{
echo '<tr><td align="right"><div class="a_container"><a href="http://www.animerealmz.net/' .$array[$i][1 ].'">' .$array[$i][0 ].'</a></div></td>' ;
echo $td2 = $array[$i+$rows] ? '<td class="center_td"><div class="a_container"><a href="http://www.animerealmz.net/' .$array[$i+$rows][1 ].'">' .$array[$i+$rows][0 ].'</a></div></td>' : '<td class="center_td"><div class="a_container"> </div></td>' ;
echo $td3 = $array[$i+( $rows*2 ) ] ? '<td align="left"><div class="a_container"><a href="http://www.animerealmz.net/' .$array[$i+( $rows*2 ) ][1 ].'">' .$array[$i+( $rows*2 ) ][0 ].'</a></div></td>' : '<td><div class="a_container"> </div></td>' ;
echo '</tr>' ;
}
echo '</table>' ;
?>
and now i get an error
i can't get it to work no matter what i do
i made it work last night useing the same method i am now to edit the galleries.php file
Parse error: syntax error, unexpected '"', expecting ',' or ';' in /home/animerea/public_html/galleries.php on line 53
on here
http://www.animerealmz.net/VOL_gallery.php
even the other script you posted last won't work now for some odd reason.
08-11-08, 04:31 AM
Newbie Coder
Join Date: Jun 2007
Posts: 30
Thanks: 0
Thanked 0 Times in 0 Posts
i got it working who hoo !!!!
the last revision of yours gave me an error near the end of the script so i just added the new .acontainer part from the newest revision to the prior one
08-11-08, 09:14 AM
Community Liaison
Join Date: Dec 2006
Location: Tacoma, Washington USA
Posts: 3,454
Thanks: 0
Thanked 140 Times in 137 Posts
You still have a couple of problems.
First, look in your style sheet at these two styles.
Rem out the font-size parts.
CSS Code:
A:link,A:active,A:visited {
/* FONT-SIZE: 10px; FONT-WEIGHT: bold; */
COLOR: b7ccb0;
FONT-FAMILY: Verdana, Arial, Helvetica, sans-serif ;
TEXT-DECORATION: none
}
A:hover {
/* FONT-SIZE: 10px;
FONT-WEIGHT: bold;*/
COLOR: #6ea87d;
FONT-FAMILY: Verdana, Arial, Helvetica, sans-serif ;
TEXT-DECORATION: none
}
And second, at the end of the main table where you insert the gallery table from galleries.php. Close the main table first then insert galleries.php.
__________________
Jerry Broughton
08-11-08, 11:43 PM
Community Liaison
Join Date: Dec 2006
Location: Tacoma, Washington USA
Posts: 3,454
Thanks: 0
Thanked 140 Times in 137 Posts
Were still having a problem with the center column in FireFox.
It centers ok in IE but not FireFox.
I have corrected the code so it will work in both browsers.
I changed part of the CSS:
CSS Code:
.center_td {
width :50 %; /* Adjust this value for width of display. */
}
And I changed part of the HTML in the PHP code:
The complete code:
CSS Code:
<style>
.gallery_header {
text-align :center ;
padding :25px;
padding-bottom :0px;
}
.a_container {
width :210px;
font-size :20px;
font-weight :bold ;
text-align :left ;
padding-bottom :30px; /* Adjust this value to add spacing. */
}
.center_td {
width :50 %; /* Adjust this value for width of display. */
}
.h3_style {
color :silver ;
font-family :arial;
}
</style>
<?php
$array = array(
array( "Card Captior Sakura" ,"CCS_gallery.php" ) ,
array( "Record Of Lodoss" ,"LODOSS_gallery.php" ) ,
array( "Gundam Wing" ,"GW_gallery.php" ) ,
array( "Sailor Moon" ,"SM_gallery.php" ) ,
array( "Tenchi" ,"TEN_gallery.php" ) ,
array( "Fushigi Yuugi" ,"FY_gallery.php" ) ,
array( "Evangelion" ,"EVA_gallery.php" ) ,
array( "Dragon Ball Series" ,"DB_gallery.php" ) ,
array( "Series Experament Lain" ,"LAIN_gallery.php" ) ,
array( "CowBoy Bebop" ,"CB_gallery.php" ) ,
array( "Trigun" ,"TRI_gallery.php" ) ,
array( "EscaFlowne" ,"EF_gallery.php" ) ,
array( "Yu Gi Oh" ,"YUGI_gallery.php" ) ,
array( "Macross" ,"MAC_gallery.php" ) ,
array( "Appleseed Series" ,"AS_gallery.php" ) ,
array( "Bleach" ,"BLEACH_gallery.php" ) ,
array( "Blue Seed" ,"BSeed_gallery.php" ) ,
array( "Death Note" ,"DeathNote_gallery.php" ) ,
array( "Naruto" ,"NARUTO_gallery.php" ) ,
array( "Robotech" ,"OnePiece_gallery.php" ) ,
array( "Yu Yu Hakusho" ,"YYH_gallery.php" )
) ;
sort( $array) ;
$rows = ceil( count( $array) /3 ) ;
echo '<table width="100%" border="0" cellpadding="0" cellspacing="0"><tr><td colspan="3" class="gallery_header"><br /><HR color=silver><h3 class="h3_style">ARZ Home</h3><a href="http://www.animerealmz.net">Home</a><HR color=silver><h3 class="h3_style">My Gallery Pages</h3></td></tr>' ;
for( $i=0 ;$i<$rows;$i++)
{
echo '<tr><td align="right"><div class="a_container"><a href="http://www.animerealmz.net/' .$array[$i][1 ].'">' .$array[$i][0 ].'</a></div></td>' ;
echo $td2 = $array[$i+$rows] ? '<td align="center" class="center_td"><div class="a_container"><a href="http://www.animerealmz.net/' .$array[$i+$rows][1 ].'">' .$array[$i+$rows][0 ].'</a></div></td>' : '<td align="center" class="center_td"><div class="a_container"> </div></td>' ;
echo $td3 = $array[$i+( $rows*2 ) ] ? '<td align="left"><div class="a_container"><a href="http://www.animerealmz.net/' .$array[$i+( $rows*2 ) ][1 ].'">' .$array[$i+( $rows*2 ) ][0 ].'</a></div></td>' : '<td><div class="a_container"> </div></td>' ;
echo '</tr>' ;
}
echo '</table>' ;
?>
__________________
Jerry Broughton
Last edited by job0107; 08-11-08 at 11:52 PM .
Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
Thread Tools
Display Modes
Linear Mode
Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts
HTML code is Off