| Author |
Message |
THoTH
Newbie


Joined: Oct 12, 2006
Posts: 12
|
Posted:
Wed Jul 01, 2009 4:00 am |
|
I'm having a problem tapping these links
| Code: |
'"(?<!/)modules.php\?name=phpBB3&file=viewtopic&f=([0-9]*)&t=([0-9]*)"',
'"(?<!/)modules.php\?name=phpBB3&file=viewtopic&f=([0-9]*)&t=([0-9]*)&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#234000p234000
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) |
| |
|
|
 |
montego
Site Admin/Owner


Joined: Feb 12, 2005
Posts: 1139
|
Posted:
Thu Jul 02, 2009 2:44 pm |
|
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 |
|
|
 |
THoTH
Newbie


Joined: Oct 12, 2006
Posts: 12
|
Posted:
Fri Jul 03, 2009 7:17 am |
|
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. |
| |
|
|
 |
montego
Site Admin/Owner


Joined: Feb 12, 2005
Posts: 1139
|
Posted:
Sat Jul 04, 2009 11:46 am |
|
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 |
|
|
 |
THoTH
Newbie


Joined: Oct 12, 2006
Posts: 12
|
Posted:
Sun Jul 05, 2009 6:39 am |
|
It's helped a lot !
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&file=viewtopic&f=([0-9]*)&t=([0-9]*)&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&file=viewtopic&f=([0-9]*)&t=([0-9]*)&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. |
| |
|
|
 |
montego
Site Admin/Owner


Joined: Feb 12, 2005
Posts: 1139
|
Posted:
Sun Jul 05, 2009 10:15 am |
|
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 |
|
|
 |
THoTH
Newbie


Joined: Oct 12, 2006
Posts: 12
|
Posted:
Sun Jul 05, 2009 10:54 am |
|
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. |
| |
|
|
 |
THoTH
Newbie


Joined: Oct 12, 2006
Posts: 12
|
Posted:
Mon Jul 06, 2009 3:40 pm |
|
No worries bud, I'll work something out take care |
| |
|
|
 |
montego
Site Admin/Owner


Joined: Feb 12, 2005
Posts: 1139
|
Posted:
Mon Jul 06, 2009 4:28 pm |
|
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 |
|
|
 |
THoTH
Newbie


Joined: Oct 12, 2006
Posts: 12
|
Posted:
Tue Jul 07, 2009 4:51 am |
|
It wasn't in the source of the page after clicking the link to it, so someone is taking the P !
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
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
It's good to be home  |
| |
|
|
 |
montego
Site Admin/Owner


Joined: Feb 12, 2005
Posts: 1139
|
Posted:
Tue Jul 07, 2009 4:37 pm |
|
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 |
|
|
 |
THoTH
Newbie


Joined: Oct 12, 2006
Posts: 12
|
Posted:
Wed Jul 08, 2009 5:29 am |
|
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 ! 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.
This would be the mod of the century  |
| |
|
|
 |
montego
Site Admin/Owner


Joined: Feb 12, 2005
Posts: 1139
|
Posted:
Wed Jul 08, 2009 6:45 pm |
|
Thanks THoTH. Your enthusiasm might just rub off on me!
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 |
|
|
 |
THoTH
Newbie


Joined: Oct 12, 2006
Posts: 12
|
Posted:
Wed Jul 08, 2009 7:26 pm |
|
You gotta admit that re-ordering an integrated page so that it's output can be compliant is a task for a super hero
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.. |
| |
|
|
 |
THoTH
Newbie


Joined: Oct 12, 2006
Posts: 12
|
Posted:
Tue Aug 04, 2009 5:59 am |
|
I fixed the double tag issue easily enough and ended up doing a new theme in the process 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 The preview looks great too.
Nearly done with the nuketobb3 links, there's a ton of em ! |
| |
|
|
 |
|
|