21
wrtbooks
Re: ShortURLs hack
  • 2004/2/24 4:35

  • wrtbooks

  • Just popping in

  • Posts: 77

  • Since: 2003/3/8 1


does anyone know if there is a version of the short url for RC 1.3 the older version of xoops?

22
reynaldo
Re: ShortURLs hack
  • 2004/2/24 4:54

  • reynaldo

  • Not too shy to talk

  • Posts: 106

  • Since: 2004/2/13


wrtbooks:

I don't know if there is as I just started using XOOPS as of version 2.06

I don't know the way previous XOOPS versions work, but have you tried to use it with them?

23
wtravel
Re: ShortURLs hack

Hi Reynaldo,

I tested the hack and it is working fine for the standard modules. Great work!!

I also made a custom module and when I activate the hack by enabling the call to xoops_shorturls.php in mainfile.php, I cannot see anything anymore in that custom module.

Do you have any key pointers where I may look for to solve this issue? When not calling the xoops_shorturls.php file everything is back to normal.

-- Edited: I found out that in the code of the pages that are giving the problems in the custom module all have something in common. They contain an object creating code... for example:
Quote:

ob_start();
include XOOPS_ROOT_PATH."/modules/amazon/recommended2.php";
$xoopsTpl->assign('recommended', ob_get_contents());
ob_end_clean();


I think this clashes with the Quote:
ob_start("short_urls");
code in xoops_shorturls.php.

Do you know what can solve this issue?

Regards,

Martijn

24
reynaldo
Re: ShortURLs hack
  • 2004/2/25 21:49

  • reynaldo

  • Not too shy to talk

  • Posts: 106

  • Since: 2004/2/13


Martinjn:

As far as I know, everything you posted is correct. Maybe your module is generating some error and you can't see it because of the OutputBuffer function in my Hack.

I've found out that if you are using ShortUrls 0.2 and you activate PHP debug *or* a module spits an error during execution, you may get a blank page, this is caused by the Gzhandler directive at the first call to ob_start()

Just to be sure, edit Xoops_shorturls.php and comment out the first line, the one that says:
ob_start("ob_gzhandler");

Try it and let me know if you see an error.

25
wtravel
Re: ShortURLs hack

Hi Reynaldo,

I will test it tonight to see if it is working. And otherwise I might consider changing my module, since there must be another way of calling the page contents than using the object coding. Although I still think it is odd. I also use XoopsForm and the object coding there does not lead to any problems.

In the meantime I was thinking about the possibility of calling a query in the db in order to convert links like: news.php?locationid=75 into china-news.html by using a table with locations. And the other way around, the china-news.html page should be translated back to news.php?locationid=75.

Do you know if this is possible?

Regards,

Martijn

26
wtravel
Re: ShortURLs hack

I checked the file and I actually left the compressing code out already. I started with version 0.1

So that is not the trouble maker. I will try to let my module get the object differently, for example by making a function for it and not getting the whole code as an object.

Regards,

Martijn

27
wtravel
Re: ShortURLs hack

I found the problem, which was a second include of mainfile.php, used in the Amazon results template. Outcommented that line and now it is working.

For me that leaves the question about the possibility of using MySQL queries in the hack. If not, then I think the best alternative would be to change the module so that it uses the location name initially and then get the location ID from that name.

Regards,

Martijn

28
reynaldo
Re: ShortURLs hack
  • 2004/2/26 20:38

  • reynaldo

  • Not too shy to talk

  • Posts: 106

  • Since: 2004/2/13


Quote:

wtravel wrote:
I found the problem, which was a second include of mainfile.php, used in the Amazon results template. Outcommented that line and now it is working.

I'm glad you could find it

Quote:

For me that leaves the question about the possibility of using MySQL queries in the hack. If not, then I think the best alternative would be to change the module so that it uses the location name initially and then get the location ID from that name.

I kinda got lost on this one, would you like to explain further?

29
wtravel
Re: ShortURLs hack

Hi,

Quote:
In the meantime I was thinking about the possibility of calling a query in the db in order to convert links like: news.php?locationid=75 into china-news.html by using a table with locations. And the other way around, the china-news.html page should be translated back to news.php?locationid=75.


What I would like to do is to use the ShortUrls hack in combination with the use of a 'locations' table. In that table for example locationid 75 = China. To view a page with news specifically for China I would like to use this locationid to get only articles assigned to locationid 75.

I would like the normal links converted to short urls, with the location name included in the link.

The only way I can do that is to use a query in the xoops_shorturls.php file, so that 75 is converted to China and I get a URL news-china.html after the conversion.

Is it possible to do this? So, I would like to know if I can use globals $xoopsDB and use $xoopsQuery etcetera. I hope I am explaining it better now

Martijn

30
reynaldo
Re: ShortURLs hack
  • 2004/2/27 15:13

  • reynaldo

  • Not too shy to talk

  • Posts: 106

  • Since: 2004/2/13


Martin:

I think it is possible to do what you say, but right now I'm trying to get ShortURLs to work correctly with the most common modules. After that I can take a look at your request.

All I can say right now is that in order to achieve that, you would have to put all the 'mapping' info into a file and not into a DB. The reason is that the loader file (loadpage.php) is called even before XOOPS is called and adding support for DB queries would make the normal loading process slow for other modules.

Just out of curiosity, why do you what urls to be converted like that? as far as I know Search Engines are giving that much importance to keywords in the file name as they used to a few years ago, and besides, with ShortUrls new ver.0.3, that URL would be /news-location-75.html

Login

Who's Online

191 user(s) are online (103 user(s) are browsing Support Forums)


Members: 0


Guests: 191


more...

Donat-O-Meter

Stats
Goal: $100.00
Due Date: Mar 31
Gross Amount: $0.00
Net Balance: $0.00
Left to go: $100.00
Make donations with PayPal!

Latest GitHub Commits