Montego Scripts: Forums
 

 

View next topic
View previous topic
Post new topic   Reply to topic
Author Message
THoTH
Newbie
Newbie



Joined: Oct 12, 2006
Posts: 12

PostPosted: Wed Jul 01, 2009 4:00 am Reply with quote

I'm having a problem tapping these links

Code:
'"(?<!/)modules.php\?name=phpBB3&amp;file=viewtopic&amp;f=([0-9]*)&amp;t=([0-9]*)"',

'"(?<!/)modules.php\?name=phpBB3&amp;file=viewtopic&amp;f=([0-9]*)&amp;t=([0-9]*)&amp;p=([0-9]*)"',


The urlout array for these entries is:


Code:
'ftopict-\\2.html',

'ftopicp-\\2.html#\\2',



The ftopict url's come out fine, but the one with the # is coming out like this..

ftopicp-234000.html#234000&#p234000

Any ideas why I'm getting #p with the post number at the end? or how to stop it ?

Is it because I'm ignoring the f parameter?

(I've tried swapping the url in entries so the largest is at the top, but it makes no difference, the urls come out as above)
 
View user's profile Send private message Visit poster's website
montego
Site Admin/Owner
Site Admin/Owner



Joined: Feb 12, 2005
Posts: 1399

PostPosted: Thu Jul 02, 2009 2:44 pm Reply with quote

I really need you to post the original full URLs that you are attempting to tap with the above arguments.

_________________
“To err is human, but when the eraser wears out ahead of the pencil, you’re overdoing it.”
-- Josh Jenkins 
View user's profile Send private message Visit poster's website
THoTH
Newbie
Newbie



Joined: Oct 12, 2006
Posts: 12

PostPosted: Fri Jul 03, 2009 7:17 am Reply with quote

Hi thanks , I know how busy you are. The URLs are


1) modules.php?name=phpBB3&file=viewtopic&f=1&t=20928 - view topic

2) modules.php?name=phpBB3&file=viewtopic&f=1&t=20928&p=233831#p233831 - view post

It's the second one that appends the #p etc.

I also need to tap threads that go over a page these have the url format of

modules.php?name=phpBB3&file=viewtopic&f=15&t=126&start=10

I've worked out almost all of the other links, and kept them to my existing link format.

If you can point me at somewhere I can learn how this urlin and urlout work, I could progress further without bothering you? Specifically how in the urlout array that the number digits replace the urlin parameters. Or if there's a way to strip out the unused parts after the url conversion. I tried string manipulation but it gave me a white screen.
 
View user's profile Send private message Visit poster's website
montego
Site Admin/Owner
Site Admin/Owner



Joined: Feb 12, 2005
Posts: 1399

PostPosted: Sat Jul 04, 2009 11:46 am Reply with quote

First how urlin and urlout work. Basically, the preg_replace() function is being used simply passing in the urlin and urlout arrays. I would take a look at that in the PHP manual to understand how it is being used.

The bottom line is that you MUST provide a regular expression pattern to match the URL to the modified and then modify it the way you want it. The output that you are seeing is exactly what you are telling preg_replace to do. I believe your urlin line is correct, however, your urlout line is not. Try the following instead:

urlout:

'ftopicp-\\3.html,

Let me explain how this works. The"\\3" references the third match node in from your urlin statement. See how the "p" parameters is the third node in?

Now, the #pNNNNNN will not be matched, so it will not be replaced, however, since everything in front of it will be replaced, it will produce a valid HTML internal anchor structure like this:

ftopicp-NNNNNNN.html#pNNNNNNNN

Hopefully this helps some.

_________________
“To err is human, but when the eraser wears out ahead of the pencil, you’re overdoing it.”
-- Josh Jenkins 
View user's profile Send private message Visit poster's website
THoTH
Newbie
Newbie



Joined: Oct 12, 2006
Posts: 12

PostPosted: Sun Jul 05, 2009 6:39 am Reply with quote

It's helped a lot ! Smile

Admittedly my head starts spinning at regex but I am grasping at least the principles involved. Bear with me on this..

The url as follows

modules.php?name=phpBB3&file=viewtopic&f=1&t=20928&p=233831#p233831 - view post

Which I mistakenly said was view post, is in fact view last post


My urlin line was as follows


(?<!/)modules.php\?name=phpBB3&amp;file=viewtopic&amp;f=([0-9]*)&amp;t=([0-9]*)&amp;p=([0-9]*)#([0-9]*)


But I realised that 233831#p233831 would be treated as one parameter ? So I changed my urlin to read

(?<!/)modules.php\?name=phpBB3&amp;file=viewtopic&amp;f=([0-9]*)&amp;t=([0-9]*)&amp;p=([0-9]*)



Then tried using the '3' replacement as you suggested and I do get a link as you've said in the format of:


ftopicp-NNNNNNN.html#pNNNNNNNN

Which is one character additional to what I need to match the previous links. The character being the p



The link should look like

ftopicp-NNNNNNN.html#NNNNNNNN


For compatibility, and I was wondering if there was a way to strip that p out? I realise it can't be done with regex in the urlin line, as it won't make the match?


To be honest, I thought ([0-9]*) would only take the numerical match and ignore the p. Hmm..

Thank you so much for helping me grasp the principles here.
 
View user's profile Send private message Visit poster's website
montego
Site Admin/Owner
Site Admin/Owner



Joined: Feb 12, 2005
Posts: 1399

PostPosted: Sun Jul 05, 2009 10:15 am Reply with quote

No, you should leave the link for #pNNNNN exactly as I had it. This is an in page anchor and it has to be that exact anchor id name, i.e. with the "p", otherwise, it will not work. (It won't bring the user to the "last post" as intended.

_________________
“To err is human, but when the eraser wears out ahead of the pencil, you’re overdoing it.”
-- Josh Jenkins 
View user's profile Send private message Visit poster's website
THoTH
Newbie
Newbie



Joined: Oct 12, 2006
Posts: 12

PostPosted: Sun Jul 05, 2009 10:54 am Reply with quote

The links for the latest posts I have on my live site don't have the p after the # character. Wanted to remove for compatibility, but I don't know how it will affect the pages I have indexed with Google etc if I have the new link format.
 
View user's profile Send private message Visit poster's website
THoTH
Newbie
Newbie



Joined: Oct 12, 2006
Posts: 12

PostPosted: Mon Jul 06, 2009 3:40 pm Reply with quote

No worries bud, I'll work something out Smile take care
 
View user's profile Send private message Visit poster's website
montego
Site Admin/Owner
Site Admin/Owner



Joined: Feb 12, 2005
Posts: 1399

PostPosted: Mon Jul 06, 2009 4:28 pm Reply with quote

Sorry, was actually in transit and back home now. I guess I am confused as the URL that phpBB3 is producing, the one you posted above, is this:

Quote:
modules.php?name=phpBB3&file=viewtopic&f=1&t=20928&p=233831#p233831


That has the "#p" in it. I would follow a specific example, like the one above, to that page and check the HTML for the page and specifically looking for an anchor tag with that number in it... does it have the "p" in front of it, or not? I would think if phpBB3 is producing the "p" that it would be needed...

_________________
“To err is human, but when the eraser wears out ahead of the pencil, you’re overdoing it.”
-- Josh Jenkins 
View user's profile Send private message Visit poster's website
THoTH
Newbie
Newbie



Joined: Oct 12, 2006
Posts: 12

PostPosted: Tue Jul 07, 2009 4:51 am Reply with quote

It wasn't in the source of the page after clicking the link to it, so someone is taking the P ! Laughing

Seriously, the only anchor is "start-here" so am guessing there's some code that replaces the P with "start-here" or something.

The good news is I've done about 20 or so taps now for the module, the bad news is my eyes are bloodshot Laughing

With the shortlinks code, when the page is read into a buffer so that the links can be rewritten, would it be possible do you think to run a script that calculates the most common words on that page for an SEO meta-tags generation? Obviously I'd have to strip out the html etc. Just thinking out loud really Smile

It's good to be home Cool
 
View user's profile Send private message Visit poster's website
montego
Site Admin/Owner
Site Admin/Owner



Joined: Feb 12, 2005
Posts: 1399

PostPosted: Tue Jul 07, 2009 4:37 pm Reply with quote

Yes, that should be possible and you have just given me another idea for ShortLinks... Maybe I can make it more generic and allow you to add any number of "plug-ins" to do various things to the buffered output. Hhhhhmmmm... interesting idea indeed with multiple potential benefits, such as even Cross-Site Request Forgery stoppage (see CSRF Magic from the folks who developed HTML Purifier).

_________________
“To err is human, but when the eraser wears out ahead of the pencil, you’re overdoing it.”
-- Josh Jenkins 
View user's profile Send private message Visit poster's website
THoTH
Newbie
Newbie



Joined: Oct 12, 2006
Posts: 12

PostPosted: Wed Jul 08, 2009 5:29 am Reply with quote

I have some good code for extracting the most common words out of a text variable, it then stores them in an array ready to insert as meta tags? Ideally the meta tag keywords should match the most common words of the page, using this method and the code mentioned above would be a godsend ! A plugin based shortlinks sounds tremendous ! Very Happy Cross site forgery prevention would be a major boost for security too.

It could also allow the stuff between the head tags of the new phpbb3 module to be moved to between the head tags of nuke!! (as is they get written after the body tag) Which means all those delicious seo phpbb3 mods (tags, zero duplicates etc) would then work!

Dam, is it nerdy to get excited about this stuff? because I am. Laughing

This would be the mod of the century Cool
 
View user's profile Send private message Visit poster's website
montego
Site Admin/Owner
Site Admin/Owner



Joined: Feb 12, 2005
Posts: 1399

PostPosted: Wed Jul 08, 2009 6:45 pm Reply with quote

Thanks THoTH. Your enthusiasm might just rub off on me! Laughing

Ah.... the O'l double <head> issue in phpBBx. That is always an issue when one considers using an integration between *nuke and phpBB rather than a bridge. For RN, we had to find and strip out that double header code wherever it was.

BTW, kguske is working on an amazing new 2.0 release of nukeSEO that is going to rock your world I think. You can even override page titles and a few key meta tags manually by page. It might be worth giving him a "ping" to see if he'd be willing to have you on a beta tester list or something.

_________________
“To err is human, but when the eraser wears out ahead of the pencil, you’re overdoing it.”
-- Josh Jenkins 
View user's profile Send private message Visit poster's website
THoTH
Newbie
Newbie



Joined: Oct 12, 2006
Posts: 12

PostPosted: Wed Jul 08, 2009 7:26 pm Reply with quote

You gotta admit that re-ordering an integrated page so that it's output can be compliant is a task for a super hero Laughing

I toyed with bridging on another site, and while it's got it's pro's, I guess I like integration for a smoother more consistent look as it were. And the thought that layout and navigation need some consistency. Thanks for the tip by the way I'll head over there too, haven't been there a while. Great guys..
 
View user's profile Send private message Visit poster's website
THoTH
Newbie
Newbie



Joined: Oct 12, 2006
Posts: 12

PostPosted: Tue Aug 04, 2009 5:59 am Reply with quote

I fixed the double tag issue easily enough and ended up doing a new theme in the process Laughing they just needed to come out of overall_header.html in the forum templates.

I just saw nukenav preview and there's mention in there about changing content before it's displayed (tags etc) that sounds very cool indeed. And a bit familiar Laughing The preview looks great too.

Nearly done with the nuketobb3 links, there's a ton of em !
 
View user's profile Send private message Visit poster's website
Display posts from previous:       
Post new topic   Reply to topic

View next topic
View previous topic
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB © 2001-2007 phpBB Group
All times are GMT - 4 Hours
 
Forums ©
linear-bunch
linear-bunch