VaultNetwork.netVault Network Boards
Author Topic: Ok board for PHP/SQL help? Looking to make first/previous/next/last buttons [Locked]
Evilynne  2 stars
Title: Inamorata
Posts: 315
Registered: 2004-9-2 21:54:49
beibhinn posted:

I've no idea what went on in this thread, but whatever it was - it was awesome

 

-----signature-----
Time has stopped before us, the sky cannot ignore us, no one can separate us, for we are all that is left. The echo bounces off me, the shadow lost beside me, there's no more need to pretend, cause now I can begin again
Phases_OgMaxim  1 star
Posts: 52
Registered: 2002-7-16 16:32:23
Oh it WAS awesome! And with any luck it's going to get more awesome.


Raiz, check this out.


How crazy does this sound. Ok, so the sites workin' real well with the images numbered 1xxx.jpg, which is fine by me and I don't plan to change that.


But, get this. You see the "Archive" page on there? I'm manually editing that. What say you, to this:


Either, a) start naming the files 1xxx_Name_of_Comic.jpg and have the index page do what it's doing.. and in addition have the archive page strip out the first five chars and NOT use them, replacing all underscores with spaces - so it just displays the name but still links to the comic - whiles till keeping them in numerical order.


Or b) keep naming files as is but have some special tag on them that I'm currently unaware of that the archive page pulls from to get a title I set, yet still sort them in order of the numbers. (I feel like there are meta type tags that can go on media.. for author and crap like that?)


What do you think of thems apples?


Edit: Ok on first test, just renaming the files 1xxx_whatever.jpg breaks them, the script explodes out more than just the extension?

Edit again: aww crap, this would mess it all up anyway, the way the + and - 1's work and what not.


Ah well, no biggie.

 

-----signature-----
Every forum should have a Phases.
Bringing SSP back to life at http://www.superstickphase.com !
Retired AC/AC2 - Phases Og'Maxim - Leafcull
Raiztlin  2 stars
Title: Dick Tracy
Posts: 397
Registered: 2002-1-23 08:10:37
you can use a database to do that.


you just need a simple table with two values.

Just use a SQL database for the archive I guess.


------------------

| id | title |

------------------

|1001|description|

|1002|description|

|1003|description|

------------------


To make a link, just do a select to get it all, print the link as <a href="images/[id]">[description]</a>


Make a loop of it, and you're set.


(my dp.php file: http://pastecode.org/7638)


to use it, just include it (include 'db.php' in the files where you need a database connection.


<?


$sql = "SELECT * FROM tablename";

$query = mysql_query($sql)

or die(mysql_error());


while ($db_row = mysql_fetch_array($query)) {

echo "<a href=\"images/".$db_row['id'].".jpg\">".$db_row['description']."</a>";

}

 

-----signature-----
I has a flavor!
CC always welcome.
Raiztlin  2 stars
Title: Dick Tracy
Posts: 397
Registered: 2002-1-23 08:10:37
the only problem with that, is that you have to populate the database somehow. This can also be done via PHP but then you're talking a bit of work.

 

-----signature-----
I has a flavor!
CC always welcome.
Phases_OgMaxim  1 star
Posts: 52
Registered: 2002-7-16 16:32:23
Yeah, which sorta defeats the purpose.


But check it out, I added a jCarousel to the archive!


http://superstickphase.com/archive.php


Pretty pimp I think!


Now I guess I'd have to figure out a way to edit the .php when an image was loaded in, and that'd have to be a cronjob I guess of some sort, with a bit of scripting to find the ul and add a li at the end, so... yeah. A bit beyond the scope of this methinks

 

-----signature-----
Every forum should have a Phases.
Bringing SSP back to life at http://www.superstickphase.com !
Retired AC/AC2 - Phases Og'Maxim - Leafcull
Evilynne  2 stars
Title: Inamorata
Posts: 315
Registered: 2004-9-2 21:54:49
so, now we have reached even more awesome?

 

-----signature-----
Time has stopped before us, the sky cannot ignore us, no one can separate us, for we are all that is left. The echo bounces off me, the shadow lost beside me, there's no more need to pretend, cause now I can begin again
Raiztlin  2 stars
Title: Dick Tracy
Posts: 397
Registered: 2002-1-23 08:10:37
well, you can always call the images. 1xxx_whatever-you-want.jpg. And rewrite the explode function. then load only the numbers into an array and sort it.

 

-----signature-----
I has a flavor!
CC always welcome.
Phases_OgMaxim  1 star
Posts: 52
Registered: 2002-7-16 16:32:23
Do you know if it's possible to have <li> or <ol> but not have it break lines? so instead of the output being


1.

2.

3.


I can have 1. 2. 3. ?

 

-----signature-----
Every forum should have a Phases.
Bringing SSP back to life at http://www.superstickphase.com !
Retired AC/AC2 - Phases Og'Maxim - Leafcull
Digero  3 stars
Posts: 580
Registered: 2002-10-21 23:55:01
Phases_OgMaxim posted:

Do you know if it's possible to have <li> or <ol> but not have it break lines? so instead of the output being


1.

2.

3.


I can have 1. 2. 3. ?



As far as I know, this isn't possible with HTML*. If you're generating the list with PHP, you can just keep track of the numbers with a counter variable.


<?php $i = 1; ?>

<?= $i++ ?>. Apple <?= $i++ ?>. Bananna <?= $i++ ?>. Cranberry

<?php

foreach ($moreFruits as $fruit) {

echo $i++,". $fruit ";

}

?>


* You can use the display:inline style for the <li> elements but then it won't show the numbers.

 

-----signature-----
[LotRO] Digero (Guardian), Digrim (Burglar), Dignite (LM), Azrea (Hunter) - Landroval
[AC] Digero, Lyera, Draxxe - Leafcull (Retired)
[CoH] Devil's Zealot, Scinta, Izzard - Guardian (Retired)
Digero's AC Decal Plugins: http://decal.acasylum.com
Phases_OgMaxim  1 star
Posts: 52
Registered: 2002-7-16 16:32:23
I don't want the numbers, but they were better than the bullets... so that works perfect!


What happened was - that archive scroll I have here:


http://superstickphase.com/archive.php


Someone pointed out that with high security settings, with "Active Scripting" disabled (or the no-script plugin with firefox) it just displayed the pictures as a list with bullets all down the page. Can you imagine what that would do with 100 comics?


SO, now, with the inline style it just does rows of thumbnail pictures and works out pretty nice.


Perfect.


Thanks!

 

-----signature-----
Every forum should have a Phases.
Bringing SSP back to life at http://www.superstickphase.com !
Retired AC/AC2 - Phases Og'Maxim - Leafcull

VaultNetwork.net is an independently operated community forum and is not affiliated with, endorsed by, or technically based on IGN, GameSpy, FilePlanet, GameStats, or the former IGN/GameSpy Vault Network.
References to VaultNetwork.net mean this site/domain. VNBoards-style presentation is a visual homage only. By using this site, you agree to the forum rules.