| Author |
Message |
montego
Site Admin/Owner


Joined: Feb 12, 2005
Posts: 954
|
Posted:
Sat Mar 03, 2007 11:41 am |
|
This question came up in a recent forum thread and I felt like it deserved a Sticky response (since I have not had time to get my Wiki up and populated).
Any module and/or block, or even any other link for that matter, can have their links shortened with just a few short steps:
1) For just a new block going against an existing tapped module, simply create a new GTB-block-<<block name>>.php script using the existing GTB and GT files for that module. I have found that in 99% of the cases, once a module's links are "tapped", the block(s) use the same links and so there are usually on additional .htaccess statements required, just the new GTB/GT.
2) For a completely new module, use your browser's "copy link" feature and save off each link into a text file for later reference. At least copy those links that you will want to shorten.
3) Copy an existing module's GT-<<module name>>.php script to a new one and give it the name of the new module (the module name to use is the directory name for that module under the modules directory.
4) Modify the $urlin and $urlout arrays for each of the links that you copied off from step 2) above. The Sticky here has some good information on how to work with regex and mod_rewrite.
5) Add to your .htaccess file the needed RewriteRule statements to expand the URLs back to what they need to be for PHP-Nuke to work.
I know there are a lot of details left out, but these involve some basic understandings of PHP and regex and Apache mod_rewrite. It is difficult to teach these skills... you just have to try them on your own and use the numerous other ShortLinks as examples.
Good luck! |
_________________ “To err is human, but when the eraser wears out ahead of the pencil, you’re overdoing it.”
-- Josh Jenkins |
|
|
 |
Dawg
Newbie


Joined: Mar 15, 2006
Posts: 12
|
Posted:
Tue Aug 28, 2007 7:32 am |
|
I have been reading here all morning but I guess I missing something.
I have a custom mod....
modules.php?name=BCHC
So I create a GT-BCHC.php file and place it in the Shortlinks folder with this in it....Simple Mod...Only one link...
| Code: |
<?php
$urlin = array(
'"(?<!/)modules.php\?name=BCHC"'
);
$urlout = array(
'BALTIMORE_CANYON_TO_HATTERAS_CANYON.html'
);
?>
|
Then I go into my htaccess file and put....
| Code: |
#BCHC
RewriteRule ^BALTIMORE_CANYON_TO_HATTERAS_CANYON.html modules.php?name=BCHC [L] |
Now here is my question....I do all of this....then go into my main menu and I still get
modules.php?name=BCHC
What am I missing in this? |
| |
|
|
 |
montego
Site Admin/Owner


Joined: Feb 12, 2005
Posts: 954
|
Posted:
Tue Aug 28, 2007 7:50 am |
|
The GT-BCHC.php only taps the module (when you are IN the module) and nothing else. To also tap the menu link, if you are using the standard nuke modules block, you would also add these things into your GTB-block-Modules.php script. |
_________________ “To err is human, but when the eraser wears out ahead of the pencil, you’re overdoing it.”
-- Josh Jenkins |
|
|
 |
Dawg
Newbie


Joined: Mar 15, 2006
Posts: 12
|
Posted:
Tue Aug 28, 2007 8:30 am |
|
Ok, I thought it was me...Is it safe to just change the links in the menu?
I am using Sommaire.
Dawg |
| |
|
|
 |
montego
Site Admin/Owner


Joined: Feb 12, 2005
Posts: 954
|
Posted:
Tue Aug 28, 2007 8:33 am |
|
If your link is of type "External" you can make it whatever you like, however, I also have the "Tap" for Sommaire in my downloads if you do not already have it. It is just another GTB file...
*Edited* - as long as it matches what your rewrite is! Sorry, thought I'd better throw that in there... |
_________________ “To err is human, but when the eraser wears out ahead of the pencil, you’re overdoing it.”
-- Josh Jenkins |
|
|
 |
Dawg
Newbie


Joined: Mar 15, 2006
Posts: 12
|
Posted:
Tue Aug 28, 2007 9:19 am |
|
Do I stll have to hard code the links using Extenal?
Dawg |
| |
|
|
 |
Dawg
Newbie


Joined: Mar 15, 2006
Posts: 12
|
Posted:
Tue Aug 28, 2007 9:23 am |
|
Never mind I got it....I have to change the SL block code to match...DUH!
Dave |
| |
|
|
 |
montego
Site Admin/Owner


Joined: Feb 12, 2005
Posts: 954
|
Posted:
Tue Aug 28, 2007 8:58 pm |
|
Glad you got it sir!
Regards,
montego |
_________________ “To err is human, but when the eraser wears out ahead of the pencil, you’re overdoing it.”
-- Josh Jenkins |
|
|
 |
|
|