Previous Thread
Next Thread
Print Thread
Rate Thread
Joined: Jun 2002
Posts: 303
Enthusiast
Enthusiast
Joined: Jun 2002
Posts: 303
Ok, if you saw my post in chit chat regarding a links project, I've begun one. Here's where I am so far. http://www.fish-tails.net/dev_test/ubbthreads/links.php?op=Links

I'll come back with a list of features I'm working on, but it's built from scratch at this point, and is designed with UBBThreads in mind. I started the project yesterday.

I need some assistance on loops. If you follow the link you will get to the main list of categories. When building my table cells, I want 3 columns, as opposed to the 9 that are there.

Here's how my output goes:

Retrieve main (or parent) categories
Begin my loop with a while statement.
Retrieve sub categories
Start second loop sequence for listing subs below tha mains.
Close second loop
Close first loop.

Now when I output, I want each main category with its sub categories in one table cell, But I want to be able to customize the table so that the number of columns can be changed by the admin, i.e. customize the display. I'm puzzled on how to start a row with three columns, then continue down with the rest of the cells in sequence.

Did I confuse you? I confused myself. Any suggestions on how to go about this?

Thanks.

Sponsored Links
Joined: May 1999
Posts: 1,715
Addict
Addict
Joined: May 1999
Posts: 1,715
Since you are going to make it integrated with threads I'd recommend using the threads way of doing templates.

Thus, you should first put the categories in an array, possibly with subcategories as an array in the array of main categories.

Then, in the template, you have a loop that goes through the array and outputs table cells for each main category. For each iteration of the loop you increment a variable by one, and if that number can be divided by the number of columns you want, you just print the </tr>.

Something like this:
Code
<br />$CatColumns = 3;<br />$Numberofcats = 15;<br /># This calculates the number of cells we need.<br />if ( $Numberofcats % $CatColumns != 0 ) {<br />   $cells = $Numberofcats + ( $CatColumns - ( $Numberofcats % $CatColumns ) );<br />} else {<br />   $cells = $Numberofcats;<br />}<br /><br />for ($i = 1; $i <= $cells; $i++) {<br />   # Check if this is the first cell of the row.<br />   if ( ($i - 1) % $CatColumns == 0 ) {<br />      print "<tr>\n";<br />   }<br />   # Make sure we have something to print.<br />   if ( $i <= $Numberofcats ) {<br />      print "<td> $i. {$catarray[$i]['name']} </td>\n";<br />   } else {<br />     print "<td> <!-- empty cell --> </td>\n";<br />   }<br />   # Check if this is the last cell of the row.<br />   if ( $i % $CatColumns == 0 ) {<br />      print "</tr>\n";<br />   }<br />}<br />

Joined: Jun 2002
Posts: 303
Enthusiast
Enthusiast
Joined: Jun 2002
Posts: 303
Thanks Gardener, that worked like a charm. I'm having a little trouble with my sub cats within the main array, but with some plucking around I'm sure I'll get to it. Actually it looks good with just the main categories on the main page. Maybe I should leave it like this, then when you go to the category have the sub cats listed there, kind of like yahoo style I guess. What do you, or any one else think?

Joined: May 1999
Posts: 1,715
Addict
Addict
Joined: May 1999
Posts: 1,715
That is how I have it on my site, but having them all on the first page might be more efficient for the users.

What is the problem with the sub cats?

Joined: Aug 2000
Posts: 1,609
Addict
Addict
Offline
Joined: Aug 2000
Posts: 1,609
This is a great idea, fishtails!

I wouldn't mind beta testing it for you.

Sponsored Links
Joined: Mar 2000
Posts: 21,079
Likes: 3
I type Like navaho
I type Like navaho
Joined: Mar 2000
Posts: 21,079
Likes: 3
looks like a great start... good luck


- Allen wavey
- What Drives You?
Joined: Nov 2001
Posts: 10,369
I type Like navaho
I type Like navaho
Joined: Nov 2001
Posts: 10,369
Yeah, this is looking really cool.

Joined: Jun 2002
Posts: 303
Enthusiast
Enthusiast
Joined: Jun 2002
Posts: 303
Thanks everyone. I wanted to contribute something back to the community. I figure there had been many requests for this and the only alternative was to get a prebuilt and hack away. Forget that. I'm tired of hacking prebuilts to fit, cause once an upgrade comes out you have to rehack all the time. Creating one from scratch is proving much, much easier and besides, I'm learning in the process.

BTW, Gardener, I figured out the subcat array thingy. Took me a little while, but as you can see, I got the subcats displaying in the proper column. Now I can continue on wih the rest of the script. Thanks for the help.

Now, I have some questions regarding the structure of the script. The following is the way I am currently setting it up, so as not to need ANY mod to threads other than links in the registered/unregisterd and admin tmpl.

ubbthreads/links.php // the main script that runs it all
ubbthreads/links/links_fns.php // contains all functions to run the script
ubbthreads/links/config.php // configuration, of course
ubbthreads/links/admin/adminscripts.php // self explanatory
ubbthreads/links/templates/tmpl.tmpl // templates
ubbthreads/links/images/ // future use

I think thats everything. Comments on this structure?

Now, regarding the templates. I'm using the threads way of utilizing templates, but I'm confused as to their advantage. Can someone clarify this for me?

Meanwhile, I'm on my way out the door to do a little fishing, kayak fishing that is. First time fishing out of a kayak, and writing an article on my adventure, or misadventure for my fishing site. Hope I don't tip over! The water is a chilly 51 degrees.

Joined: Aug 2002
Posts: 1,191
Kahuna
Kahuna
Joined: Aug 2002
Posts: 1,191
Mike

It looks great. Allow me a couple of comments

- The table structure you propose is in my view the optimal one. This way you have one folder that contains the links and everything in neat and tidy, without "interfering" with the threads files.
- For the images you definitely can use them to put something next to each category
- The templates are a MUST. The reason that I am saying this is because once you set them up (and your script uses them) with a single change in the appropriate stylesheet, you keep uniformity across your whole site. This was the reason that this big noise is generated for the templates and if I may add is one of the strongest points (but not the only one) of the threads.
- Lastly, I would like to see when I hover on top of a category, how many items it has in there. People would definitely find this useful, especially now at the beginning where you don't have that many links up.

I hope this helps and that you don't end up in the water...


Nikos
Joined: Jun 2002
Posts: 303
Enthusiast
Enthusiast
Joined: Jun 2002
Posts: 303
Please take a moment to have a look at what I have so far in regards to a links directory. http://www.fish-tails.net/dev_test/ubbthreads/links.php?op=Links I hope to have an alpha release or maybe beta release within two weeks, hopefully I'll have the time to get something out by then. Please note that the submit link does not work, because I haven't written that page yet. Just wanted folks to have a look see and tell me if I am on the right track or not. Comments on aesthetics as well as potential functions are requested.

Also, a name for the script has not been thought up yet. Threads-Links? ILP (Integrated Link Page)? Suggestions wanted.

One other thing. Please don't expect a top of the line links page right off the bat. Though I am paddling upstream, I am making headway, I believe.

One other thing. Should I begin a thread in Mod suggestions, or should I just wait til I have something to release and post in the beta forum?

Thanks for any and all input!

Sponsored Links
Joined: Jun 2001
Posts: 3,273
That 70's Guy
That 70's Guy
Offline
Joined: Jun 2001
Posts: 3,273
It's looking really great!

I wouldn't start a post in the beta mods untill you are able to post the scripts for all to try out. That way people wont be asking where the scripts are to download... lol

One thing I noticed though. The number of queries is rather high. When I accessed the page there was 47 total. With what I have in use at my main website there is perhaps only 4 or 5 (for the links). When I update it for inclusion into IIP pro I'll have a more exact count.. lol

Once your code's posted we could try and help to figure out how to cut the number of queries down.


All in all though your doing a fantastic job.

Joined: Nov 2001
Posts: 10,369
I type Like navaho
I type Like navaho
Joined: Nov 2001
Posts: 10,369
Wow!

Looking great!

Can't wait to have scripts to try out.

Great work. I love that it counts the number of clicks.

Great work so far, keep us posted on your progress.

Joined: Jan 2002
Posts: 674
Junior Member
Junior Member
Offline
Joined: Jan 2002
Posts: 674
Looking good... will be a great addition the the features of threads users.

Joined: Aug 2002
Posts: 1,191
Kahuna
Kahuna
Joined: Aug 2002
Posts: 1,191
I like it a lot Mark. Yes the query number is quite high but that can be looked a bit more in detail when you are ready to post the modification for all of us to use. I like the ILP name

If I were you I would tidy up the things that I have done/will do and post the mod here. Then once it is optimized we can all sit down and enhance it even further. There is no point in trying to implement everything in one go, since you will never finish it


Nikos
Joined: May 1999
Posts: 1,715
Addict
Addict
Joined: May 1999
Posts: 1,715
Name suggestion: TLD - Threads Link Directory. Just to confuse people. =P

I've been thinking of changing link directory script into something using a mysql backend and have been thinking of MyThreads links for some time, maybe adding some threads integration. But of course it would be nice to have something that doesn't have to re-hacked every once in a while, so your project is interesting.

Unfortunately, I would need some functions to be able to use it. Among them is the following:
  • Multiple category levels - sub-categories of sub-categories is a must, with no limit on the levels.
  • Rating - I believe site owners linked in our directory would go nuts if they aren't on our top list any more...
  • Search - This is a must, it's a bit hard to find things otherwise.
  • Templatable - I have a person running another site who keeps our directory up to date who get's the directory with their own look.
  • Change links - Visitors should be able to submit new information of links already in the directory. Otherwise we'd have to do a lot of work.

If you were to add these functions I would'nt hesitate to use your script.

Of course, there are other things I would like but wouldn't be necessary, like random link, sort by date entered (and other stuff), a system to check if links are working etc.

And a comment on your current version, show the sub categories on the category page, as well as a total count of all links in the category together with the sub categories. It was a bit confusing to see "There are 1 links in this category." when entering a category which clearly had several links in the sub categories on the front page.

It seems to be on the right track though, shouldn't take long before it is usable. Looking forward to see how it turns out.

Joined: Mar 2000
Posts: 21,079
Likes: 3
I type Like navaho
I type Like navaho
Joined: Mar 2000
Posts: 21,079
Likes: 3
lookeeng good

would be nice to see gardener's thoughts implemented as well, but this one is looking real nice, I would love to import our links database into it


- Allen wavey
- What Drives You?
Joined: Mar 2000
Posts: 21,079
Likes: 3
I type Like navaho
I type Like navaho
Joined: Mar 2000
Posts: 21,079
Likes: 3
would be nice to have a 'linkspal' once this is up and running.... would show maybe the last 10 links added or the 10 most popular, etc


- Allen wavey
- What Drives You?
Joined: Jun 2002
Posts: 303
Enthusiast
Enthusiast
Joined: Jun 2002
Posts: 303
Thanks for the votes of confidence fellas! Now I'm really excited about it. I do have a list of things I want to do with it, some of which has been mentioned from others in this thread. I don't have time at the moment to lay out my intentions because I am at work and am due back any moment, but expect a 'game plan' sometime this evening. Basically, I have to type it up in notepad then cut and paste into the message. Hmmm... Has any one suggested a 'Draft' feature to Rick? I can start a post, save it as a draft, then come back later to finish it and post to the forums......etc. It would be nice, since sometimes a post can get real long, and I only have so many minutes in a break. Gotta go. Will post my plans later.

Joined: Jun 2001
Posts: 3,273
That 70's Guy
That 70's Guy
Offline
Joined: Jun 2001
Posts: 3,273
Hey that "draft" idea is sweet!

This should be made into a modification... (hint, hint)

In about 2 weeks I'll work this one over if nobody else does. I like it.

Joined: Jun 2002
Posts: 303
Enthusiast
Enthusiast
Joined: Jun 2002
Posts: 303
I thought the 'draft' idea might raise some interest.

Anyway, here's somewhat of a roadmap for what I would like to do with this.

Ok, I hope to make a release for an alpha phase sometime this weekend, Sun maybe? In this release will be the most basic of the script. The template system will be utilized from the get go, and I'm also starting the lang pack as well. If it's OK, I'll take care of the english.

There will be one file called links.php which is in the same directory as the UBBThreads files, and then a subdirectory called links which will be in the threads directory much like the pal directory. All files will be prefixed with links, ex. links_add_link.php etc. Also, the tables will use the prefix feature in threads, thereby allowing more than one link script to be run on the same db.

The alpha release will comprise the following functionality:

  • Link categories
  • Link Subcategories
  • The Links themselves
  • Suggest a link ( Submit a link )


Admins will be able to:
  • Add / delete categories
  • Add / delete sub-categories
  • Approve / Deny new link submissions


I realize this seems to be extremely limited, but there is a reason for it. What I would like to do is release this alpha for critique by some of you gurus out there so I can get some initial feedback on the code itself, i.e. clean code or any kind of security flaws that may be apparent, the structure of the directories/files as well as a look at how I have the db tables structured. With this feedback I can then improve where need be, and optimize code or db based on your input. Perhaps there is a more efficient way such as a reduction in the number of queries, etc.

Once any changes or bugs are worked out, then I'll have a good idea on which way to take the rest of it.

The following features list is what I am aiming for, not necessarily in any order.

  • Search feature
  • Newest links
  • Most popular links
  • Links rating
  • Recomended links - possibly by the admin with a review/editorial?
  • Unlimited depth of categories
  • Linkspal for IIP - selectable from latest, popular, or recomended links, or main cats for a center pal, JustDave?
  • Bookmarks - website members can add links to their favorites and get recomendations from other members as well


Did I miss anythin? Anyway, what does everyone think about this roadmap and the alpha phase?

Joined: Nov 2001
Posts: 10,369
I type Like navaho
I type Like navaho
Joined: Nov 2001
Posts: 10,369
You have a great plan of attack!

Good work. I'm excited about this.

Joined: Jun 2001
Posts: 3,273
That 70's Guy
That 70's Guy
Offline
Joined: Jun 2001
Posts: 3,273
Putting together a "linkspal" at some point won't be a problem.

Joined: May 1999
Posts: 1,715
Addict
Addict
Joined: May 1999
Posts: 1,715
It all sounds very good, it is a good idea to start small and get the basics finished first. The plan of future features seems perfect, now I'll only have to decide if I should wait for this to be finished... I will surely try it out once you release it.

I'll help you with a Swedish translation at least, even if I won't use it myself.

BTW, I also like the draft idea.

Joined: Aug 2002
Posts: 1,191
Kahuna
Kahuna
Joined: Aug 2002
Posts: 1,191
I really really like this plan of action and would definitely use this mod in one of my boards.

I will also help with the hellenic translation

Great news Mark. Keep up the good work!


Nikos
Joined: Mar 2000
Posts: 21,079
Likes: 3
I type Like navaho
I type Like navaho
Joined: Mar 2000
Posts: 21,079
Likes: 3
Great plan, I want it too


- Allen wavey
- What Drives You?
Joined: Jun 2002
Posts: 303
Enthusiast
Enthusiast
Joined: Jun 2002
Posts: 303
Well, I just read that JustDave has a links program for his IIP Pro. I didn't see his posts til now, otherwise I would have just bagged it. Oh well. Anyway, I was unable to get the time I needed in order to make the release tonight, so it will be tommorrow evening, hopefully. My daughter has a science fair project and she has asked for my guidance. Daughter is my life, so she has priority.

Joined: Nov 2001
Posts: 10,369
I type Like navaho
I type Like navaho
Joined: Nov 2001
Posts: 10,369
Don't let that discourage you.

IIP Pro won't appeal to everyone. Different strokes for different folks.

I look forward to seeing your mod.

Joined: Jun 2001
Posts: 3,273
That 70's Guy
That 70's Guy
Offline
Joined: Jun 2001
Posts: 3,273
Yes please don't think that your scripts are not needed. They are! Everything in IIP Pro will be as tied together as possible. Your stand-alone link directory will probably be more appealing.

Looking forward to installing it here!

Joined: Aug 2002
Posts: 1,191
Kahuna
Kahuna
Joined: Aug 2002
Posts: 1,191
I totally agree. Even though I don't know what IIP Pro will do with regards to links, your idea and implementation Mark can well be an add-on for the threads and why not later on a standard feature. I know already one board that wants this with features for users to rate the links (these will be vendor links)


Nikos
Joined: Mar 2000
Posts: 21,079
Likes: 3
I type Like navaho
I type Like navaho
Joined: Mar 2000
Posts: 21,079
Likes: 3
yes, please continue


- Allen wavey
- What Drives You?
Joined: Apr 2001
Posts: 3,266
Member
Member
Offline
Joined: Apr 2001
Posts: 3,266
Yes interested in this mod as well

Joined: Jun 2002
Posts: 303
Enthusiast
Enthusiast
Joined: Jun 2002
Posts: 303
Thanks for the confidence builder guys. Working on the admin script today, and if all goes well then I'll have an alpha release this evening. Right now, though, my daughter and I are working on finishing up her science project, so once we get done I can start coding again. Thanks again.

One question though, since this really isn't a 'mod' or 'hack' and more of an addon, which forum should I post/upload the zip file to, Forum Design Integration?

Joined: Apr 2001
Posts: 3,266
Member
Member
Offline
Joined: Apr 2001
Posts: 3,266
Forum Design Integration no doubt

Joined: Mar 2000
Posts: 21,079
Likes: 3
I type Like navaho
I type Like navaho
Joined: Mar 2000
Posts: 21,079
Likes: 3
yes, that's probably where it fits best


- Allen wavey
- What Drives You?
Joined: Jun 2002
Posts: 303
Enthusiast
Enthusiast
Joined: Jun 2002
Posts: 303
Zipping it up now. Should be up in about thirty minutes or so.

Joined: Nov 2001
Posts: 10,369
I type Like navaho
I type Like navaho
Joined: Nov 2001
Posts: 10,369
Wonderful!

Congratulations.

Joined: Aug 2002
Posts: 1,191
Kahuna
Kahuna
Joined: Aug 2002
Posts: 1,191
Wooohoo! Gimme Gimme Gimme!!!



Nikos

Link Copied to Clipboard
Donate Today!
Donate via PayPal

Donate to UBBDev today to help aid in Operational, Server and Script Maintenance, and Development costs.

Please also see our parent organization VNC Web Services if you're in the need of a new UBB.threads Install or Upgrade, Site/Server Migrations, or Security and Coding Services.
Recommended Hosts
We have personally worked with and recommend the following Web Hosts:
Stable Host
bluehost
InterServer
Visit us on Facebook
Member Spotlight
isaac
isaac
California
Posts: 1,157
Joined: July 2001
Forum Statistics
Forums63
Topics37,573
Posts293,925
Members13,849
Most Online5,166
Sep 15th, 2019
Today's Statistics
Currently Online
Topics Created
Posts Made
Users Online
Birthdays
Top Posters
AllenAyres 21,079
JoshPet 10,369
LK 7,394
Lord Dexter 6,708
Gizmo 5,833
Greg Hard 4,625
Top Posters(30 Days)
Top Likes Received
isaac 82
Gizmo 20
Brett 7
WebGuy 2
Top Likes Received (30 Days)
None yet
The UBB.Developers Network (UBB.Dev/Threads.Dev) is ©2000-2024 VNC Web Services

 
Powered by UBB.threads™ PHP Forum Software 8.0.0
(Preview build 20221218)