PDA

View Full Version : [MOD] AJAX Category Selection - for huge databases (Update 12-06-2006)


Boby
06-09-2006, 05:04 AM
Hi @ all

I know some of you phpLD users have really huuuuge databases and the category selection on the submit page not only loads very hard, but it also creates large server loads and makes it almost impossible for users to load the page or select a category.

Based on the powerful Javascript framework Prototype, the AJAX Category Selection is a new and effective approach to category selections in your PHP Link Directory submition forms. It builds, selective, the category tree step-by-step, fast and live :)
It's build into the main template, so you won't have popups or don't need to force users to use the category they are comming from.

All needed files, images, stylesheet, tpl's, javascripts, documentation are included in the package.
The module can be added to all versions of PHP Link Directory.
Installation time: maximum 10 mins.
Download: http://www.frozenminds.com/phpld-ajax-categories.html

And here is a screenshot:

Content visible to registered users only.

Notes:
I have tested this mod with Firefox 1.5.0.3, Opera 8 and 9, Konqueror 3.5.2, Epiphany 2.14.2 and Internet Explorer 6.

The main libraries used in this module, Prototype and script.aculo.us (http://script.aculo.us/), are both freely distributable under the terms of the MIT license. In respect to their authors, this module is also free available under the terms of the MIT license.

Hope you like it and please let me know if you add it to a directory, I'd like to see it in action.

Thanks, Boby!

Update on 12-06-2006 (ver 1.1)
List of fixes:
Javascript errors when not browsing the submit page.
New feature, when category tree is open and clicking on "Change category", the tree will close.
Background color of category title in Konqueror webbrowser.
Howto update:
Replace categ_selection.js with the new available.
Add following property to your CSS file (change to your default bg-color of the page):
Content visible to registered users only.

Steven Myers
06-09-2006, 05:19 AM
This may seem stupid, but where is the download link! I want to get this baby installed :D

Nice job Boby, can't wait to see it in action on my site :D

Boby
06-09-2006, 05:25 AM
Content visible to registered users only.
Yeah, I forgot the download link :mad: stupid me!
http://www.frozenminds.com/phpld-ajax-categories.html

Updated the previous post also!
Seems like I'm getting tired, should take a nap ... ZZzzzz

Content visible to registered users only.
Thanks :)
Yeah, I'd like to see it somewhere else installed too ;)

Boby

Steven Myers
06-09-2006, 05:30 AM
Hey Boby!

Just got a small error, seems a string is off: Content visible to registered users only.

Boby
06-09-2006, 05:37 AM
Have you added dirdb.php file to the include/ folder?
Have you included this file in init.php?
Content visible to registered users only.
The correct call is:
Content visible to registered users only.
Check correct case: you have getcategorytitlebyid

Boby

Steven Myers
06-09-2006, 05:43 AM
Ok I added the second line below to my init.php below the first line and I get my category drop down as blank.

Content visible to registered users only.

Content visible to registered users only.

Boby
06-09-2006, 05:48 AM
Checked now {non working link removed}
Seems like you don't make all required changes. Have you read the documentation.html that comes with the package? There are all steps listed and each code on it's correct position.

You still have a blank dropdown list, the mod is not generating a form list.
Have you also edited submit.tpl ?

Boby

Steven Myers
06-09-2006, 06:08 AM
Thank you!

Tool in live action at {non working link removed} select a category and hit submit, then click "Change Category" to test it out.

Thank you again Boby for this excellent tool, I'll modify the coloring right now :D

EDIT: Color changed for hover over and also background. Boby, I'll donate to you for this mod, this is the coolest tool I have seen for PHPLD bro, wonderful job well done!!!

Boby
06-09-2006, 06:23 AM
Thanks Steve :D

One suggestion: remove the mod you have that blocks submition when comming from the main page. Whenever you reload the page or do a failed submit everything is gone...the user needs to browse again the category and hit again the submit page. Don't worry now, this mod won't let submissions pass that have no category selected and hard loading of the categories is also history ;)

Boby

Steven Myers
06-09-2006, 06:27 AM
Done, thank you Boby for pointing that out :D

Bill
06-09-2006, 04:03 PM
Looks good, Im going to put it on 2.0 and see if it works.

Neticus
06-09-2006, 08:10 PM
There is one problem I've noticed, IE browser, it also happens on your demo set up.

The on-the-fly character count no longer works for the description field and meta description field.

EDIT:

@Steve Myers

Did you come across the same problem and change something? It seems to work fine with character count on your directory.

I have intstalled it on an a vanilla v305 and have this character count problem same as Boby's demo.

Steven Myers
06-09-2006, 11:03 PM
Neticus, you're deffinently right about the Character limit counting, it doesn't display how many are left when you type. I tested this in IE 7 and FF 1.5.0.4 both latest version browsers.

To be honest, I am not sure why this happens but it is really odd, you might want to ask Boby to see what changes could be made and possibly if it's a template issue (Which might be the case)

P.S I am afraid this script might keep viewers from submitting links because I am noticing that a lot of people are looking at the submit page and not submitting. I am hoping that this is not because of the script, and hopefully it is because of the NoFollow Attribute I have set for the Free Links option, (spammers :p)

Neticus
06-10-2006, 12:03 AM
I don't think its a template issue, I've installed it on an unaffected default phpld305 and still same issue.
I suspect it may be a javascript call conflict in the header.tpl. In IE I also get an 'error on page/icon alert' on all pages even when I'm not on submit.php. Removing javascripts/categ_selection.js from header stops the errors but of course also stops the category select from working.

Boby
06-10-2006, 12:21 PM
The on-the-fly character count no longer works for the description field and meta description field.[/SIZE][/quote]
Thanks for the report!
I will check and hopefully find a solution ;)

Boby

gesugefu
06-10-2006, 02:50 PM
It's a great mod, thanks
{non phpLD link removed}

Jürgen

Momo
06-10-2006, 04:24 PM
Wow, thanks a lot, this is a very nice mod! It worked like a charm on my directory, and here's how it looks: http://ipage.info/submit.php

Again, thanks a lot! :D

Boby
06-10-2006, 06:24 PM
@ Neticus & Steve Myers

Have you tried clearing the cache and removing all the files in temp/templates/ ?
After I first read your posts, I've tried it out and the counter was stuck, but I worked in the meantime on phpLD 3.0.6 and had to clear the cache. Now I wanted to look at the mod and ... surprize, it works. (on my local PC)

On the demo page the counter was not working because I forgot to load the formtool Javascript library. Take a look now, it's working :)

Make sure you have this in your header.tpl:
Content visible to registered users only.

Notice:
I have replaced following line:
Content visible to registered users only. with this:
Content visible to registered users only. Because it was causing some errors, specially when phpLD is installed in a subfolder and mod-rewrite is on.

Notice2:
The formtool and overlib Javascript libraries are only for phpLD 3.0.5+
All versions before 3.0.5 don't need them!!


@ bikersshop24 & Momo

Thanks guys ;)
Nice to see on /submit.php the module styled different. Even the scriptaculous highlight color isn't yellow anymore :) (Nice)


Boby

Momo
06-10-2006, 11:56 PM
Yeah, I had to dig around to find where that color was being set :p Thank you again for this very nice mod! :)

Neticus
06-11-2006, 02:21 AM
Ahh yes thanks it works now. For some reason I didn't have formtool.js or overlibtool.js in my header I must have removed them during some testing and forgot to replace them.

One little nuisance I still get is:

In IE6 I still get an 'error on page/icon alert' at the bottom left of all pages EXCEPT on submit.php. This same error also occurs on your demo. If you view your index.php in IE6 or maybe also other browsers you will see this error message.

Content visible to registered users only. (http://imageshack.us/)

Removing javascripts/categ_selection.js from header removes the error. I think it's that. Like I said it happens on all pages except submit.php

Momo
06-11-2006, 04:55 AM
Content visible to registered users only.
What I did was to move the 3 javascript calls from header.tpl to submit.tpl. Everything works fine after that, so I think that should be alright?

Steven Myers
06-11-2006, 05:40 AM
Boby,

Thanks for the update on this, I made them real quick to the header.tpl. However I think that some people were probably not able to submit to the directory, because we're getting a lot of hits every hour, but not sure what we're doing wrong to not get any submissions.

Thanks.

Neticus
06-11-2006, 05:18 PM
Content visible to registered users only.

Thanks Momo, I only moved javascripts/categ_selection.js to submit.tpl but that seemed to do the trick.

Cheers
Net.

Boby
06-12-2006, 12:10 AM
Hey guys, can you please check this new file categ_selection.js ?

I have also updated the demo and seems like the errors dissapeared, but I want a confirmation if possible from you (IE check)

Just replace the Javascript file with the attached file.

Thanks, Boby.


Edit:
I have removed the attachement from this post. Please use the updated version of this module for latest files.

Steven Myers
06-12-2006, 01:38 AM
Is this the same version of the other category_selection.js that I have in my javascript folder?

Boby
06-12-2006, 01:44 AM
I have changed the code a bit in the attached category_selection.js in my post above. Just replace it and you are ready to go.

The only thing I've added are checks if the elements to update exists before taking any action. This should prevent execution of any code if not on submit.php

I just want to know if it works well (specially in IE) for you too. For me it worked good, no more errors.

Boby

Steven Myers
06-12-2006, 01:49 AM
I replaced it with the new one you gave us, and it works a lot better, plus your Description Limit is counting down and not freezing.

I added a Notice on my site the day you released this, saying enable javascript to use the category drop down menu, though I might need to supply a useful source for those not sure how to do that.

Thank you for this update, and great job done on the category script :D

Boby
06-12-2006, 01:57 AM
The good think is, if Javascript is not available, the category ID and title are pre-selected automatically if comming from a category and everything works as supposed but the users can not start the category tree. Yeah, I thought about accessibility and usability when I build the mod ;) everyone can use the submit page, ooold browsers like Lynx (for my tests) and crawlers, but some of them can have more features if Javascript is enabled :)

Boby

Steven Myers
06-12-2006, 02:17 AM
Is there a way to sit a default category drop down for those who don't have javascript enabled?

In other words, say you the viewer doesn't have java enabled, their is a default drop down "Like the normal one that comes with PLD" that will be available for you to use so you can submit your site to the directory, this way you "The Owner of the Directory will not lose traffic, and sales as well.

Just a thought...

Boby
06-12-2006, 02:51 AM
Hmmm, a real good thought :)

I'll do my best to get it done ;) Well, at least I'll try.

After I do this I will also update the download link.

Thanks, Boby.

Boby
06-12-2006, 11:14 PM
Hi all!

I have updated the module to version 1.1 (12-06-2006).
Please see first (http://www.phplinkdirectory.com/forum/showthread.php?p=23057#post23057) post for more info!

@ Steve Myers
I have not (yet) added your request with the normal selection list if AJAX is not available to the package. :(

Thanks, Boby!

Steven Myers
06-13-2006, 04:42 AM
No worries Boby, take your time my friend, and thank you for this :D Awesome work!

Boby, When I updated the .js file, and I click the Change Category button which on FLD it's name "Click Here To Choose a Category" it clears the category tree but doesn't close it. Although the arrow pointing updoes do the job. Not like I didn't know that before, but...you know :p

Boby
06-13-2006, 10:38 AM
Have you updated with the js file from the new package? The one that was attached in a previous post by me won't do the job.

But hey, I checked now your directory and it's workin...have I missed something?

Boby

Steven Myers
06-13-2006, 05:08 PM
No, it's working now lol, just had a glitch :)

Oh by the way, will the 3.06 provide an option for AJAX or will it come with it?

Boby
06-13-2006, 05:12 PM
I will add this mod to phpLD 3.0.6 ;)

However you will need to update the js file with the one provided in phpLD 3.0.6 because it's changed to work with admin area too.

But more info to come when 3.0.6 is released.

Boby

Leo909
06-14-2006, 05:31 PM
I have a suggestion. When the user clicks on the final category, can the selection box automatically disappear/shrink itself? I know the user can just click the little white arrow to do the same thing. But if it happens automatically then it's clear that the category has been chosen.

I'm suggesting this, because while using your demo I was clicking and then waiting to see if something else was going to appear (waiting for a deeper category list to load). If the selection box closes itself, then it is clearer that the person has chosen successfully...

Steven Myers
06-14-2006, 06:05 PM
Content visible to registered users only.

AGREED, this will deffinently save the buyer or viewer time from having to close it. It's not a huge need for the script, but it would be a nice little addon for AJAX.

Boby
06-14-2006, 06:52 PM
Yes, could be done, but what if the user wants to go back? If he is just searching categories than he has to re-open the category tree and start over.

Any suggestions to show that it's the last category and tree will close?
I am not very sure about this...

Boby

Leo909
06-14-2006, 08:27 PM
Content visible to registered users only.
They can just click the 'Change Category' link again.

Content visible to registered users only.
I don't think the user will click on a sub-category if they are just looking without actually choosing. If they do click on a subcategory and the selection box closes, they can always re-open it...

Content visible to registered users only.
I don't know if you need to show that the tree will close. But you could use a different icon for 'last categories' - maybe just an arrow or something simple? Right now the folder icon could be confusing, personally it makes me think there is something inside it to look at! :)

Just my 2 cents...

Boby
06-14-2006, 08:54 PM
You can have this feature :)
Edit categ_selection.js and find this funtion:
Content visible to registered users only. Replace it with:
Content visible to registered users only.

Small notice:
The only added code is:
Content visible to registered users only.

You can also change the icons with whatever you like or whatever fits your template best. ;)

Boby

Steven Myers
06-20-2006, 04:12 AM
@Boby:The text that says "Click here to select a category" is not showing the hand, but only shows the text cursor. Example: Hover your mouse over text and that is what I get for the clicking :p

Kinda odd :|

EDIT: did an overwrite with a backup.

Boby
06-20-2006, 12:36 PM
What browser are you using? It worked for me with FF.
OK, I'll try to find a JS solution for older browsers that cannot be styled with CSS.

Boby

Neticus
06-20-2006, 01:22 PM
@Steve Myers

If it's any help I see a hand over ''Click here to select a category" on your directory. IE6

Boby
06-20-2006, 01:28 PM
Here is a quick solution for all browsers!

Edit your CSS file and add add following property to toggleCategTree :

Content visible to registered users only.

By default it should look like this:
Content visible to registered users only.

Why this hack?
The CSS standard dictates pointer as the value for a pointer that indicates a link. The buggy IE 5 and IE 5.5 for Windows don't understand this value, they are using hand to mean the same thing. By placing pointer first misbehaving Microsoft browsers ignore it and use the hand value, while standards compliant browsers take pointer and ignore hand.

I won't add this to the default package because I do *not* want to support older browsers and specially not IE.

Boby

Leo909
06-23-2006, 01:08 AM
Special Request - how can I modify this so it automatically re-opens at the TOP level. In other words, if the person has already selected the category,
and then they re-open it to choose a different category, I would like it to re-open back at the highest category level.

Because with the current method, when it re-opens it only shows .. which is a bit confusing. Is it easy to change so that it re-opens at the top level?

Thanks,
Leo

Boby
06-23-2006, 01:51 AM
Try this out...edit categ-tree.php and search for following code:
Content visible to registered users only.
Right above it add this:
Content visible to registered users only.

Let me know if it's what you are looking for.

Boby

Tim_Myth
07-13-2006, 02:21 PM
I'm having a problem with this mod. I have PHPLD 2, and it selects the category just fine, but the list is empty. Clicking Reload empties the entire category selection box. Clicking the Up Arrow shows that the next higher category has been selected, but still displays none of the categories.

One thing that confuses me is in the directions you state:
Content visible to registered users only.
Does that mean after the two $_SESSION lines or after the five lines of code I'm supposed to look for? Where exactly are the "two lines" in the five lines of code you list?

Boby
07-13-2006, 06:35 PM
Just a small typo :p
Add them after:
Content visible to registered users only.

Boby

Tim_Myth
07-14-2006, 03:09 AM
Thanks! :)

But that still didn't fix my problem. :( My ajax category selection box is still empty. I've followed all the directions. Help?

Boby
07-15-2006, 03:00 AM
Can you send me the files you changed via PM to take a look at them?

And you should also remove the basic category selection (drop down list) from the submit page.

Boby

techbull
07-16-2006, 03:41 AM
Thanks very mutch , working perfect on 3.05,

Btw is this possible to add this fonction on

htxp://www.com/admin/dir_links_edit.php ?

(Assume you have a link to edit and to change this link to another category, the same problem apear as in the submit.php on the admin side
Ie: /admin/dir_links_edit.php ..)

??

Thank you, nice thing,
i will be able to use my directory now at less !

Boby
07-16-2006, 11:15 AM
The module was added to the comming 3.0.6, only editors can not use it.
Thanks!

Boby

techbull
07-16-2006, 09:18 PM
Content visible to registered users only.

why ???
This mean the same bug will stay on the admin side even in 306 (when editing a link & want to change the cat) ???

Boby
07-16-2006, 09:22 PM
It's maybe only a problem on your directory. Nobody has reported this in 3.0.5 and I checked several times, everything works.

Boby

techbull
07-16-2006, 09:48 PM
Content visible to registered users only.

hi boby,

no its not a problem on my directory, its a problem whit phplink..

1 - Go into the admin area click on DIRECTORY then LINK
2 - choose a link, Click on Edit link (button at end) that bring (admin/dir_links_edit.php)

You have a field CATEGORY whit a rolling menu,
then assume you have 10,000 category...

I see only some category there, Its the exact same problem as in the submit.php (categories field). Right ?


I see it because i wanted to change a link that have submited but submited in wrong category, so i need to change the category but i cant because same prob as in the submit.php apear..

Boby
07-16-2006, 10:13 PM
Well, it works on my default 3.0.4, 3.0.5 and the comming 3.0.6, not only on my server, but it works actually on 4 other different servers I have tested on.
It works with the default category dropdown and with my ajax categ selection mod.
Have you also checked your database? Have you changed something else?

Boby

PS: You should maybe open a new thread for this one.

techbull
07-16-2006, 10:30 PM
It work on my side too, the problem is because i have too mutch category and not all category are displayed in the dropdown list, so i see only some category on this dropdown selection..

How i can mod this page whit the ajax mod this should correct the problem , but i dont know how to use the ajax mod on the admin/dir_links_edit.php page ? i will post another tread on it..

Ps: no nothing modded in my DB..

thank you.

vegabond
07-16-2006, 10:55 PM
There is one site that has Total 2,635,446 Active Categories.

This site owner is doing ok but you? Have a time to learn more, right?

techbull
07-17-2006, 12:10 AM
I learn ! But i can't fix the phpcode.. i'm not a programmer...
The problem is there... Have to wait for 3.06....

http://www.phplinkdirectory.com/forum/showthread.php?t=4819

cantilever
07-25-2006, 11:04 PM
Does this mod work with phpLD 2.0?

Thanks,

Neticus
07-26-2006, 12:39 AM
Content visible to registered users only.

In the first post it says

Content visible to registered users only.

anon
07-26-2006, 12:51 AM
Hey Neticus, since you are doing quite a bit of beta testing, have you tried the ajax mod on a huge database yet?

Neticus
07-26-2006, 01:27 AM
'fraid not, my max category testing is less than 500.
And if I'm right I think you're suggesting something well over 100,000 to 300,000.

I think Boby mentioned he has over 150,000 categories on his test site and probably tested this mod over there. But if I remember correctly that's still 100,000 short of FSBO! Dude that's a lot categories, but I guess if you're going to do a job, do it right Content visible to registered users only. (http://www.phplinkdirectory.com/forum/images/icons/icon14.gif)

anon
07-26-2006, 01:40 AM
ok.

actually it's short of fsbo by 2.45MIL, not 100K lol

im just prepping for something in the next few months is all. no rush on anything atm :D

thx for response.
Rob

Neticus
07-26-2006, 02:00 AM
Content visible to registered users only.

Sick :D
______

Boby
07-26-2006, 08:37 AM
If it doesn't have to query 100,000 categs a time it works. Actually the query is not a big problem, just showing them in the browser takes much time.
Let's say, you have on the front page 100,000 categs, it will work, but sloooow, if the categs are nicely structured it will work.

anon
07-26-2006, 08:45 AM
cats are nicely structured Boby ;) so no worries there.

each cat contains roughly 32,000 sub cats which are structure within one another and broken down nice and neat. if the ajax works off of a based id type query, it should be fast(grabbing only those within that category parent). They are broken down in such a way that I do believe this MOD will make great use of.

Now what I am thinking of, is an all out AJAX phpLD framework.

ohhhhhh did I just give you a good idea or what? :D

Boby
07-26-2006, 09:00 AM
Well, a complete AJAX framework is not really great, think about all those SE or users that use older browsers or have JS disabled...they won't be able to use the directory. Specially SE because they are the users of directories, have no JS, with to much AJAX it will break down functionality.

The AJAX categ mod, is ok, some more mods can be super OK too, but not the complete directory. ;)

angeljs
07-31-2006, 07:44 PM
Hi, I just can't seem to get this to work...the categories don't show up
I followed all the instructions and performed all the edits...what have I done wrong? :(

mphmi
08-01-2006, 05:41 PM
Hi. The mod says it's compatible with all versions of phpLD, but when I get to the step of editing submit.php, I'm at a loss because none of the lines it tells me to find are present in my file. It looks like this:
Content visible to registered users only.I can do all the other steps no problem. Any help with this would be immensely appreciated.

mphmi
08-03-2006, 08:37 PM
Why is my version of submit.php so different from the one included with this mod? They're not even close to being alike.
:confused:

Boby
08-03-2006, 11:51 PM
I followed all the instructions and performed all the edits...what have I done wrong? :([/quote]
Have you downloaded the mod for the correct phpLD version you are using?
Any errors, what is not working?

Content visible to registered users only.
It's not different at all :)
If you donwload the mod for version 2.0-3.0.4 and follow the instructions it will work perfect. Just installed it now on a phpLD 2 RC2 directory.

Just in case I've sent you the submit.php from above you posted modified:
Content visible to registered users only.

Hope it works now.
Boby

mphmi
08-05-2006, 01:09 AM
Yes it does work now, thank-you! I didn't pay enough attention to the download page. I saw "Latest Version" and thought that the top download link was for the latest version of the mod, and the lower was an earlier version, not noticing they were for the different versions of phpLD. Thanks so much for this awesome mod.

Boby
08-05-2006, 01:49 AM
Take care next time when you donwload something :D :D

ven
08-18-2006, 08:32 PM
can someone tell me how i change the hover-color for the categoriename on top of the menu? it's this yellow.

Boby
08-21-2006, 11:22 PM
Content visible to registered users only.
You can change the colors to anything you like. Just edit categ_selection.js and look for following line:
Content visible to registered users only.
Customize it to something like:
Content visible to registered users only.

Script.aculo.us documentation on effect highlight:
http://wiki.script.aculo.us/scriptaculous/show/Effect.Highlight

Boby

Timeless
02-20-2007, 07:25 AM
Hi,

this Mod is great. The only bad thing what i could c on this one was, that its javascript bases. So if one hadnt it activated the tree is not working! I know, the preselection functions works. But better it would be, that when java is off the normal drop down selection come up.

The problem here is, that javascript is a browser language and php is server side. So php dont know if javascript is off or not. But i found with a lil trick a working solution for me! if someone is interested on this one. let me know..then i will posts the steps!

Boby
02-20-2007, 07:32 AM
If Javascript is disabled you won't have also support for AJAX. The fallback of this mod is it stores the category where you're comming from.

Any improvements are appreciated, not only by me but also from anybody else. So why don't you share your little secret?

Timeless
02-20-2007, 07:46 AM
ui fast response! sure i can post..no problem!

1. make a file called pixel.php

inside write:

<?php
session_start();
if (isset($_SESSION['imgcount'])) {$_SESSION['imgcount']++;}else{$_SESSION['imgcount']=1;}
$image = imagecreate(1,1);
$pixelcolour=imagecolorallocate($image,222,222,222 );
imagecolortransparent($image,$pixelcolour);
imagesetpixel($image, 0, 0,$pixelcolour );
header("Content-Type: image/png");
imagepng($image);
exit;
?>

so we set a 1 pixel on the website. nobody will c it!

2. open footer and set this anywhere u want:

<noscript>
<img src="pixel.php">
</noscript>

header is also possible. its just have to be loaded to the beginning!

3. change in the submit.tpl the category selection to:

{if $imgcount}
{html_options options=$categs selected=$CATEGORY_ID name="CATEGORY_ID" highlight=$top_level_categs}{validate form="submit_link" id="v_CATEGORY_ID" message=$smarty.capture.no_url_in_top}
{else}
{include file="category_select.tpl"}
{/if}

4. set in the submit.php the assign and the else!

if (isset($_SESSION['imgcount']))
{
$categs = get_categs_tree($db, 0);
$tpl->assign('categs', $categs);
}else{
$tpl->assign('CategoryTitle', $CategoryTitle);
}

$tpl->assign('imgcount', $imgcount);



It works for me! if someone open direct the submit formular it will not work, but if he come over the startside what usally is, it will work! test it!
-------------

Muneeb2Good
04-01-2007, 05:10 PM
hi i need this mod please help me ...

shadav
04-01-2007, 05:49 PM
this does sound nice :) any chance on an update lol and well a working download :D
thanks

Muneeb2Good
04-03-2007, 06:01 PM
hi please anyone help me i need my directory to be work with ajax live catagory selection i have 2.1 phpld please i need it to be done asap as the submit page loads very very slow and i m having complaints for it too.

Richieboy67
04-03-2007, 06:32 PM
Is there anyway to download this?? I would be happy to mirror this if you need it????

Thanks

Boby
04-05-2007, 08:58 AM
My homepage is (was) redesigned and I need to complete some things, but had no time for it.
Please PM me your email address and I will send it, also let me know your phpLD version.

Boby

MrKool
05-18-2007, 11:27 PM
Ajax Category mod :


Error:
Notice: SmartyValidate: [register_validator] form '' is not registered. in /home/content/r/a/s/html/WebDirectory/libs/smarty/SmartyValidate.class.php on line 375


Warning: Smarty error: validate: validator id 'v_CATEGORY_ID_TOP_LEVEL' is not registered. in /home/content/r/a/s/html/WebDirectory/libs/smarty/Smarty.class.php on line 1095



Anyone can help me

Boby
05-19-2007, 07:07 PM
With v_CATEGORY_ID_TOP_LEVEL I see you have another mod installed. Seems like you have broken that one. Probably removed the validation tags.


PS: Please do not post your problems in more than one thread or forums! I have removed the other one.

MrKool
05-20-2007, 04:36 AM
Which validation tag should to remove ?



My submit.php code is :

------------------------------------------------------
<?php

/**
# ################################################## ####################
# Project: PHPLinkDirectory: Version 2.1.2
#
# ************************************************** ********************
# Copyright (C) 2004-2006 NetCreated, Inc. (http://www.netcreated.com/)
#
# This program is free software; you can redistribute it and/or
# modify it under the terms of the GNU General Public License
# as published by the Free Software Foundation; either version 2
# of the License, or (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program; if not, write to the Free Software
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
# ************************************************** ********************
#
# For questions, help, comments, discussion, etc., please join the
# PHP Link Directory Forum http://www.phplinkdirectory.com/forum/
#
# @link http://www.phplinkdirectory.com/
# @copyright 2004-2006 NetCreated, Inc. (http://www.netcreated.com/)
# @projectManager David DuVal <david@david-duval.com>
# @package PHPLinkDirectory
# ################################################## ####################
*/

ob_start( 'ob_gzhandler' );

require_once 'init.php';

$topLevelCategs = $db->GetCol("SELECT `ID` FROM `{$tables['category']['name']}` WHERE `PARENT_ID` = '0' AND `STATUS` = '2'");



//Make an additional check if client is allowed to post/submit
//[Spam] protection
require_once 'include/check_post_rules.php';
$post_rules_unauthorized = check_post_rules($_POST);

//Evaluate payment options
if (PAY_ENABLE == '1' && PAYPAL_ACCOUNT != '')
{
$price = array ();
if (FTR_ENABLE == '1' && PAY_FEATURED > 0)
{
$price['featured'] = PAY_FEATURED;
}
if (PAY_NORMAL > 0)
{
$price['normal'] = PAY_NORMAL;
if (PAY_ENABLE_FREE)
{
$price['free'] = 0;
}
}
if (PAY_RECPR > 0)
{
$price['reciprocal'] = PAY_RECPR;
}
$tpl->assign('price', $price);

if (isset ($_REQUEST['LINK_TYPE']))
{
$link_type = $_REQUEST['LINK_TYPE'];
switch ($link_type)
{
case 'reciprocal' :
$recpr_required = 1;
break;
case 'free' :
$recpr_required = REQUIRE_RECIPROCAL;
break;
default :
$recpr_required = 0;
break;
}
}
else
{
$recpr_required = 0;
}
$_SESSION['SmartyValidate']['submit_link']['validators'][6]['empty'] = ($recpr_required ? 0 : 1);
$_SESSION['SmartyValidate']['submit_link']['validators'][7]['empty'] = ($recpr_required ? 0 : 1);
}
else
{
$recpr_required = REQUIRE_RECIPROCAL;
}

//Determine category
$CategoryID = (!empty($_REQUEST['c']) && preg_match ('`^[\d]+$`', $_REQUEST['c']) ? intval ($_REQUEST['c']) :
(!empty ($_SERVER['HTTP_REFERER']) ? get_category($_SERVER['HTTP_REFERER']) : 0));
$CategoryID = ($CategoryID > 0 ? $CategoryID : 0); //Make sure the category ID is valid
$CategoryTitle = '';



$tpl->assign('recpr_required', $recpr_required);

//Determine category
$CategoryID = (!empty($_REQUEST['c']) && preg_match ('`^[\d]+$`', $_REQUEST['c']) ? intval ($_REQUEST['c']) :
(!empty ($_SERVER['HTTP_REFERER']) ? get_category($_SERVER['HTTP_REFERER']) : 0));
$CategoryID = ($CategoryID > 0 ? $CategoryID : 0); //Make sure the category ID is valid

if (empty ($_REQUEST['submit']))
{
if (!empty ($_SERVER['HTTP_REFERER']))
$_SESSION['return'] = $_SERVER['HTTP_REFERER'];

$data = array ();
$data['CATEGORY_ID'] = $CategoryID;
$data['RECPR_REQUIRED'] = $recpr_required;

$CategoryTitle = getCategoryTitleByID($data['CATEGORY_ID']);

SmartyValidate :: disconnect();
SmartyValidate :: connect($tpl);
SmartyValidate :: register_form('submit_link', true);

SmartyValidate :: register_criteria('isValueUnique', 'validate_unique' , 'submit_link');
SmartyValidate :: register_criteria('isUrlUnique' , 'validateUrlUnique' , 'submit_link');
SmartyValidate :: register_criteria('isNotEqual', 'validate_not_equal', 'submit_link');
SmartyValidate :: register_criteria('isNotTopLevel', 'validate_not_top_level', 'submit_link');
SmartyValidate :: register_criteria('isURLOnline', 'validate_url_online', 'submit_link');
SmartyValidate :: register_criteria('isRecprOnline' ,'validate_recpr_link', 'submit_link');
SmartyValidate :: register_criteria('isCaptchaValid','validate_captc ha' , 'submit_link');

SmartyValidate :: register_validator('v_TITLE','TITLE', 'notEmpty',false,false,'trim','submit_link');
SmartyValidate :: register_validator('v_TITLE_U','TITLE:link::CATEGO RY_ID'.$EditUnique,'isValueUnique',false, false, null, 'submit_link');

SmartyValidate :: register_validator('v_URL', 'URL','isURL', false, false,'trim','submit_link');
SmartyValidate :: register_validator('v_URL_ONLINE','URL','isURLOnli ne', false,false, null,'submit_link');
SmartyValidate :: register_validator('v_URL_U', 'URL:link'.(ALLOW_MULTIPLE ? '::CATEGORY_ID' : ':'), 'isUrlUnique', false, false, null, 'submit_link');

SmartyValidate :: register_validator('v_CATEGORY_ID','CATEGORY_ID:0' ,'isNotEqual',false,false, null,'submit_link');
SmartyValidate :: register_validator('v_CATEGORY_ID_TOP_LEVEL', 'CATEGORY_ID:'.(is_array ($topLevelCategs) && !empty ($topLevelCategs) ? implode (',', $topLevelCategs) : ''), 'isNotTopLevel', false, false, false, null, 'submit_link');

SmartyValidate :: register_validator('v_RECPR_URL' , 'RECPR_URL' , 'isURL' , ($recpr_required ? false : true), false, 'trim', 'submit_link');
SmartyValidate :: register_validator('v_RECPR_ONLINE', 'RECPR_URL' , 'isURLOnline' , ($recpr_required ? false : true), false, null, 'submit_link');
SmartyValidate :: register_validator('v_RECPR_LINK', 'RECPR_URL' , 'isRecprOnline' , ($recpr_required ? false : true), false, null, 'submit_link');

SmartyValidate :: register_validator('v_OWNER_NAME' , 'OWNER_NAME' , 'notEmpty' , false, false, 'trim', 'submit_link');
SmartyValidate :: register_validator('v_OWNER_EMAIL', 'OWNER_EMAIL' , 'isEmail' , false, false, 'trim', 'submit_link');

if (count ($price) > 0)
SmartyValidate :: register_validator('v_LINK_TYPE' , 'LINK_TYPE' , 'notEmpty' , false, false, 'trim', 'submit_link');

if (VISUAL_CONFIRM == 1)
SmartyValidate :: register_validator('v_CAPTCHA' , 'CAPTCHA' , 'isCaptchaValid', false, false, 'trim', 'submit_link');

}
else
{
SmartyValidate :: connect($tpl);

$CategoryTitle = getCategoryTitleByID($data['CATEGORY_ID']);

$data = get_table_data('link');

$data['STATUS'] = 1;
$data['IPADDRESS'] = get_client_ip();
$data['VALID'] = 1;
$data['LINK_TYPE'] = $link_type;
$data['RECPR_REQUIRED'] = $recpr_required;

if ($recpr_required)
{
$data['RECPR_VALID'] = 1;
$data['RECPR_LAST_CHECKED'] = gmdate ('Y-m-d H:i:s');
}

$data['LAST_CHECKED'] = gmdate ('Y-m-d H:i:s');
$data['DATE_ADDED'] = gmdate ('Y-m-d H:i:s');
$data['DATE_MODIFIED'] = gmdate ('Y-m-d H:i:s');
$data['DESCRIPTION'] = strip_tags($data['DESCRIPTION']);
$data['TITLE'] = strip_tags($data['TITLE']);
$data['OWNER_NAME'] = strip_tags($data['OWNER_NAME']);

if (strlen (trim ($data['URL'])) > 0 && !preg_match ('#^http[s]?:\/\/#i', $data['URL']))
$data['URL'] = "http://".$data['URL'];

if (strlen (trim ($data['RECPR_URL'])) > 0 && !preg_match ('#^http[s]?:\/\/#i', $data['RECPR_URL']))
$data['RECPR_URL'] = "http://".$data['RECPR_URL'];

if (VISUAL_CONFIRM == 1 && !empty ($_POST['CAPTCHA']))
$data = array_merge ($data, array ('CAPTCHA' => $_POST['CAPTCHA']));

if (SmartyValidate :: is_valid($data, 'submit_link'))
{
if (VISUAL_CONFIRM)
{
unset ($data['CAPTCHA']);
}

if (ENABLE_PAGERANK)
{
require_once 'include/pagerank.php';
$data['PAGERANK'] = get_page_rank($data['URL']);
if (!empty ($data['RECPR_URL']))
{
$data['RECPR_PAGERANK'] = get_page_rank($data['RECPR_URL']);
}
}

$id = $db->GenID($tables['link']['name'].'_SEQ');
$data['ID'] = (!empty ($id) ? intval ($id) : '');

$data['LINK_TYPE'] = $link_type_int[$link_type];
switch ($link_type)
{
case 'free':
$data['NOFOLLOW'] = 1;
break;
case 'featured':
$data['FEATURED'] = 1;
break;
}

$data['OWNER_NOTIF'] = ($price[$link_type] > 0 ? 0 : 1 );
$data['PAYED'] = ($price[$link_type] > 0 ? 0 : -1);

if ($db->Replace($tables['link']['name'], $data, 'ID', true) > 0)
{
$tpl->assign('posted', true);
send_submit_notifications($data);

if ($price[$link_type] > 0)
{
//Move to payment page
@ header("Location: payment.php?id=".$data['ID']);
@ exit;
}
else
{
unset ($data);
}
}
else
{
$tpl->assign('error', true);
$tpl->assign('sqlError', $db->ErrorMsg());
}
}
}
unset ($_SESSION['CAPTCHA']);

$path = array ();
$path[] = array ('ID' => '0', 'TITLE' => _L(SITE_NAME), 'TITLE_URL' => DOC_ROOT, 'DESCRIPTION' => SITE_DESC);
$path[] = array ('ID' => '0', 'TITLE' => _L('Submit Link'), 'TITLE_URL' => '', 'DESCRIPTION' => _L('Submit a new link to the directory '));
$tpl->assign('path', $path);

$tpl->assign('CategoryTitle', $CategoryTitle);

$tpl->assign($data);
$tpl->assign('LINK_TYPE', $link_type);

//Clean whitespace
$tpl->load_filter('output', 'trimwhitespace');

//Make output
echo $tpl->fetch('submit.tpl', $id);
?>

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

Content visible to registered users only.

shadav
05-20-2007, 04:26 PM
Not remove a tag you Content visible to registered users only.
so check the install instructions again and see if you're missing a valadation tag from the instructions that go into the submit.php

and Boby, lol i haven't forgotten, well yes i have :D but i will get this installed on my directory lol

Boby
05-21-2007, 08:31 AM
You have another mod installed, the one that allows you to submit links into the top. Review that mod, seems like you've removed part of it.
I don't know that mod, and what it's code is, so you'll have to do it.

starliner
07-04-2007, 05:55 PM
where is the file download for category selection mod.

i cant see