PDA

View Full Version : HOW TO: Force users to submit links from category pages


djhomeless
02-02-2006, 10:06 PM
Howdy All,
If you like receiving SPAM submissions, or 100's of links from people who didn't take the time to find an appropriate category for their site, then surf away! This mod is NOT for you.

All kidding aside, the following is a bit of a hack that basically redirects users who click on submit.php when in your site root to a landing page (ala dmoz). Whenever they are on category pages, the submit works as normal.

I really am not a proper developer, and I only threw this together in about 20 minutes. What this means is, BACKUP any code that you change just in case. Also, I don't know if the template markup is radically different from template to template, so your mileage may vary. Last thing, you MUST be using mod_rewrite for this to work.

First off, we need to change the code in the phpld template so the submit script can be called by its relative path. Open the top_bar.tpl file in your template folder. Scroll down to line 4 and find the section of the code that looks like this:
Content visible to registered users only.

Change it to this:

Content visible to registered users only.

What this does is allow your site to have various links to submit.php, like:

/primarycat/secondarycat/submit.php

You'll note that I've titled the link submitlink.php. Don't worry, you won't be changing the physical submit.php filename.

Next, open your .htaccess file. Add the following code AFTER the line where you enable the re-write engine (e.g. RewriteEngine On).

Content visible to registered users only.

Ok, so this is a bit of a kludge. But it works.

The first rule does a rewrite (fancy redirect) to a file called submit.html when the user is in the root of the site.

The second rule uses a myriad of wild cards to allow for recursive directories to all send their submitlink.php requests to the actual submit.php file.

The third, is of course needed for sub cats of sub cats (e.g. cars/fords/pintos). If you have even lower categories, you will need to repeat the wild cards e.g. ([a-zA-Z0-9_]*)

I hope everyone finds this useful. I hope it actually works for you.
Enjoy!

Geoffrey

best-p4u
02-03-2006, 10:24 AM
Thanks!!

It is nice..

I will try it^^

SEO-Man
02-03-2006, 10:42 AM
thank you worked well for me.

Durty Don
02-22-2006, 02:24 AM
for some reason I get question marks in the navigation bar when I add this mod into the script. It works, I just cant figure out why the ? is there...lol

djhomeless
02-22-2006, 02:34 AM
Can you copy and paste the line from the top_bar.tpl file that you updated?

Kevuk2k
02-22-2006, 02:38 AM
Sounds great will wait for any calls on bugs and then adopt. Thanks for the contribution.

Kev

pachimondai
02-22-2006, 10:08 AM
Content visible to registered users only.

Hello,

I'm looking for a solution to display the category names on the submission page instead of the drop down list. As in your directories:

Can someone help me please?

Help very much appreciated. :roll:

Kevuk2k
02-22-2006, 12:07 PM
Content visible to registered users only.

Hello,

I'm looking for a solution to display the category names on the submission page instead of the drop down list. As in your directories:


Can someone help me please?

Help very much appreciated. :roll:[/quote]

Hi there, this is a paid for mod. That's the benefit of contributing to the site and not expecting everything for free :wink: Not that I'm suggesting you are. I would give the mod to you but this would set a precident and one that I don't want to do as there are too many people on here who are simply blind rude in running of with scripts and mods like mine that have been paid for me and others out of our hard earned cash. Hopefully someone will offer you the mod for free but if not you can always donate to me for it as it all goes into this site and further development. I've given quite a lot already! If they had a table of $$$ contributers I bet I'd be close the to the top :)

Kev

spree
03-01-2006, 11:03 PM
Hi Kev

I followed the instructions and it seems to work ok but the link is still showing in the homepage. Is that normal or have I done something wrong?

djhomeless
03-01-2006, 11:53 PM
Content visible to registered users only.

Did you remember to remove {$smarty.const.DOC_ROOT}, ie the first step above?

Whats your URL?

Geoffrey

spree
03-02-2006, 12:06 AM
Content visible to registered users only.

Did you remember to remove {$smarty.const.DOC_ROOT}, ie the first step above?

Whats your URL?

Geoffrey[/quote]


Hi Geoffrey

Thanks for the response but Stuw the template designer has very kindly sorted it out for me, but if you want to look at the site anyhow it's here

Its far from finished but I'm getting there very slowly :D

djhomeless
03-02-2006, 12:09 AM
I like how he implemented that, with regards to changing the title if your on the homepage.

Would you care to share it with the community?

Geoffrey

spree
03-02-2006, 12:17 AM
Not too sure how he did it myself Geoffrey but it was one of the .tpl files that came with the template. As it is in the contributors section I'm not sure if I am allowed to post it here. Maybe the best thing would be to PM him and ask? sorry no offence intended.

djhomeless
03-03-2006, 08:18 PM
I'm not sure I follow you here.

If your saying your designer came up with a more creative way to do this mod, then its essentually up to the designer whether the code can be shared.

If you or your designer improved this mod, or used it in any way, then you really should not exclude it from the community.

Granted, no one can force you to legally do anything. But considering I spent time doing this, then shared it with the community, I think its pretty poor to then withold the code.

Of course, you may have just not explained yourself well! So which is it?

:)

Geoffrey

anon
03-03-2006, 08:29 PM
Content visible to registered users only.

I'm not sure how he did it, but i made my own version for my site.

My .tpl's are different, but you can probably locate <title></title> in the header.tpl template. Just insert the code like i did.

For the {else}
you can add something default so when you're not surfing the categories, that message will show as a default


<title>
{if $category.ID gt 0}
{$category.TITLE}
{else}
whatever you want to say can go here if not in a subcategory{/if}
</title>

One other thing DJ:

He acquired the template from the 'support' forum, which means he put forth $10 to get in there.

While I don't know if you've put the $10 to join the forum, spree has, and therefore, if he choses not to share, that is his decision.
I think it's awesome that you offer code and help/support, and I really hope you continue to do so. I plan to. but unfortunately, people vary.

There are a few standpoints you have to look at it from.

1. Paid - supporter
2. Paid - supporter (who also supports)
3. Unpaid - non-supporter
4. Unpaid - non-supporter (who also supports)

(like i said though, i've no idea if you're a supporter or not, but i'm guessing that if you had been, you'd of downloaded the template already)

djhomeless
03-03-2006, 08:47 PM
I am a supporter, but I didn't understand what he meant by contributor section. Does he mean the safe area?

Anyway, as I said, if its a standalone mod, then its up to the designer whether or not they post the code.

Geoffrey

anon
03-03-2006, 08:58 PM
Content visible to registered users only.
I think he was refering to the template being in the 'support forum' and not openly available.

When i think 'safe area', i think where we register when we buy phpld.

Thx for your support, and try and give what i posted a shot.
It should work with no problems.

if you have any questions, Pm or post and i'll be more than happy to help out.

Rob

djhomeless
03-03-2006, 09:00 PM
Thanks Rob. I'm actually cool with what I have now. Just thought it was a cool extension to add to the mod.

At the end of the day, I'm all for whatever helps the community!

Geoffrey

spree
03-03-2006, 09:00 PM
Sorry if my response caused any offence Geoffrey, that wasn't my intention at all. Like you said in your post - I didn't really explain myself properly, I should have used the term "supporter" :oops:

I am new to the fold if you like and wasn't sure of what I can or cannot do with regard to sharing stuff that I kindly received from someone else. In fact I'm not against sharing anything apart from my motorbike and my wife (yes thats the correct order :D )

Once again please accept my apologies for any confusion caused

djhomeless
03-03-2006, 09:05 PM
Nothing to appologise for Spree! You were doing the right thing!

We have a great community here, I just misunderstood. :)

Geoffrey

MichaelMed
03-20-2006, 05:26 AM
Content visible to registered users only.

That's really nice of you to share Geoffrey. I think this would save a lot of headaches, or eliminate the need for the extra .htaccess lines for multiple sub-cats:

Open submit.tpl (The Template) and find:
Content visible to registered users only.
After that add:
Content visible to registered users only.
Basically, this will display whatever you want to tell the visitor, if he has not come from a sub-category (came from index.php/).

Okay, now we need to display the form when the visitor comes from an actual subcategory.

After the above add:
Content visible to registered users only.

Finally, go to the bottom of the Submit template and find:
Content visible to registered users only.
Before that line add:
Content visible to registered users only.

That should work like a charm and be much easier in several ways:
http://links.mjmls.com for an example of that working.

Dave,

Shouldn't I have access to the Supporters section of the Forum?

I made a voluntary contribution when this program was launching. I was probably one of the first to contribute any funds. There was no limited access or special features when I donated money to the project. I would be really greatful if a favor was returned.

Good luck everyone...

David
03-20-2006, 06:00 AM
Yes, I found your contribution.
I will let you in now.

MichaelMed
03-20-2006, 02:43 PM
Thank you David, greatly appreciated.

Steven Myers
05-28-2006, 04:08 AM
I would really like to use this mod and seen the demo in action and would like to get it running on the 3.05. Can someone post a remake of this for it to be compatible for 3.05 or someone who has it running already on 3.05 post their modifications?

Thanks :)

Steven Myers
07-02-2006, 04:51 PM
*Bump* Can this be made for 3.05?

EDIT: Nevermind, just do the same steps as given above.

David
07-02-2006, 05:31 PM
There will be 3 options in 3.06
1) Normal
2) This one (or similar)
3) Ajax category tree selection

gvii
08-10-2006, 03:44 PM
@MichaelMed (http://www.phplinkdirectory.com/forum/member.php?u=58):

I use your method, but there is a problem:

If a user select his category, click the submit-link, fill out the form and then click the submit button, the msg "link has been added" will not be shown, only the msg that you must select a category.

any idea how to fix that?

MichaelMed
08-30-2006, 08:22 PM
Content visible to registered users only.


I don't know why it's not working for you. I have been using for a long time with out a problem. Essentially, you are preprocessing the information with php, rather then bouncing users through redirects.

I am not sure what you mean by, "If a user select his category". Did he or she come from a category or use the dropdown menu?

Paste your code and someone may be able to help you out. It sounds like you have forgot to close an, "if," statement or included something that should not have been included. I am just guessing. I didn't look at my code because yours may very well be different from what I am running.

Paste your code and I will try to help you out.

Steven Myers
06-01-2007, 05:47 PM
*Bump*

This mod is compatible on 3.2 as provided by MichaelMed at the top post here on this page in which was coded in 2006, but works like a charm.

See www.PriorityList.info (http://www.PriorityList.info) for the 3.2 result of the mod.