Go Back   Mosets Community > Archives > Mosets Hot Property 1.0 > Discussions, Troubleshooting and Problems

 
 
Thread Tools Search this Thread Display Modes
  #1  
Old 01-03-2009, 06:02 AM
rtenny rtenny is offline
Mosets'd
 
Join Date: Sep 2006
Location: Spain
Posts: 613
Default Fehler in defines.php

/administrator/components/com_hotproperty/includes/defines.php

Sorry guys but how can you make so obvious errors. One file and 25 errors. I know this is a BETA but really, this should not have been released
Code:
define( 'HOTPROPERTY_MEDIA_IMAGES_COMPANY',					HOTPROPERTY_MEDIA_IMAGES . DS . JPath::clean('company') );
define( 'HOTPROPERTY_MEDIA_IMAGES_COMPANY_URL',				HOTPROPERTY_MEDIA_IMAGES_URL . 'company/' );
You either use DS or you dont, but having 2 line one after the other and STILL hard coding the / sign.

It was released on the 31.12 so maybe they have already been a bit drunk

(I must still be drunk as I write the title in german)
__________________
On the box it said "Needs Win98 or better" - so I installed Linux.

Last edited by rtenny; 01-03-2009 at 06:24 AM. Reason: add comment
  #2  
Old 01-03-2009, 07:30 AM
abernier's Avatar
abernier abernier is offline
Senior Member
 
Join Date: Jul 2008
Posts: 132
Default

Hi rtenny,

I've just reviewed the file you mentionned, but I haven't seen any inconsistency :
  • as its name suggests, DS (DirectorySeparator) constant is used to delimit file paths
  • while '/' is used as a URL delimiter
Since I've never seen any backslash in a URL, I think we can legitimately use '/' in our URL constants...
  #3  
Old 01-03-2009, 07:34 AM
rtenny rtenny is offline
Mosets'd
 
Join Date: Sep 2006
Location: Spain
Posts: 613
Default

Oh Oh,

this proves that I am the one that is still drunk.

Thanks for this lesson.
keep up the good work
__________________
On the box it said "Needs Win98 or better" - so I installed Linux.
  #4  
Old 01-03-2009, 07:29 PM
ssnobben ssnobben is offline
Mosets'd
 
Join Date: Nov 2006
Posts: 805
Thumbs up

Happy New Year anyhow and hope you are not drunk for further coding and welcome to the forum Mr Bernier!
__________________
Success in the long run Its not about the code its about the people and community that's make it!
  #5  
Old 01-05-2009, 12:52 AM
ssaguiar ssaguiar is offline
Mosets'd
 
Join Date: Apr 2008
Posts: 143
Default

Quote:
Originally Posted by abernier View Post
Hi rtenny,

I've just reviewed the file you mentionned, but I haven't seen any inconsistency :
  • as its name suggests, DS (DirectorySeparator) constant is used to delimit file paths
  • while '/' is used as a URL delimiter
Since I've never seen any backslash in a URL, I think we can legitimately use '/' in our URL constants...
I have, when testing in my local machine as localhost.

Sergio
  #6  
Old 01-05-2009, 02:14 AM
abernier's Avatar
abernier abernier is offline
Senior Member
 
Join Date: Jul 2008
Posts: 132
Default

Hi Sergio,

Please consider that article, here is an extract:
Quote:
It is a common error to use "\" instead of "/" in URLs, as in href="..\index.html" instead of the correct href="../index.html". Further confusion is caused by the phenomenon that some browsers accept the incorrect format too, so people complain that "my links work on IE but not on Netscape". This isn't about HTML itself however; it's about misunderstanding the relationship between URLs and filenames and their syntax
Which browser are you using?
Waiting for your thoughts about it...

Regards
  #7  
Old 01-05-2009, 02:31 AM
ssaguiar ssaguiar is offline
Mosets'd
 
Join Date: Apr 2008
Posts: 143
Default

Quote:
Originally Posted by abernier View Post
Hi Sergio,

Please consider that article, here is an extract:


Which browser are you using?
Waiting for your thoughts about it...

Regards
I understand this.
In any url, it must be "/", but, when referenced to a local storage file or folder, it must be "\" (except, by example, linux os).
I had this problem with hp beta3. It was using the DS (as it was in original source code) and I had no thumbnails pictures in my properties (in frontend and backend), when using a localhost system, implemented with xamp, in my machine (for testing and develop purpose).
I tested with k-meleon and IE 7, as far I remember (for sure with k-meleon - it's lighter).
After I hardcoded the "/" in place of the DS, all worked fine.
I think that this was, maybe, a Joomla problem

Sergio
  #8  
Old 01-05-2009, 03:25 AM
abernier's Avatar
abernier abernier is offline
Senior Member
 
Join Date: Jul 2008
Posts: 132
Default

  1. '/' is for URLs
    Quote:
    Originally Posted by ssaguiar
    In any url, it must be "/"
    Yes, that's why in our _URL constants, we just hard code this, like in:
    PHP Code:
    define'HOTPROPERTY_SITE_URL'JURI::root() . 'components/com_hotproperty/' ); 
  2. 'DS' is for paths
    Quote:
    Originally Posted by ssaguiar
    but, when referenced to a local storage file or folder, it must be "\" (except, by example, linux os)
    This is exactly the purpose of DS which is an alias of the PHP DIRECTORY_SEPARATOR constant, and which is a variable to the right directory separator token:
    PHP Code:
    DIRECTORY_SEPARATOR strtoupper(substr(PHP_OS,0,3)=='WIN')?'\\':'/' 
    In other words, DS value is set to:
    • '\' when your Joomla runs on Windows
    • '/' otherwise
What about me?
Quote:
Originally Posted by ssaguiar
I had this problem with hp beta3. It was using the DS (as it was in original source code) and I had no thumbnails pictures in my properties (in frontend and backend), when using a localhost system, implemented with xamp, in my machine (for testing and develop purpose).
I tested with k-meleon and IE 7, as far I remember (for sure with k-meleon - it's lighter).
After I hardcoded the "/" in place of the DS, all worked fine.
Yes, and after 1. and 2. this is logical, let me explain...

When you say 'thumbnail' you refer to an 'img' tag, which has a 'src' attribute and which expects an URL as value. And whoever says URL means only solidus characters in it(according to 1.), so no DS constant here, just hard-coded '/': case made!

Conclusion
Before Beta4, we were not using HOTPROPERTY_CONSTANTS, and we could have made mistakes with DS usage, but now, with that defines.php file, all is centralized and should be now ok, both for paths and URLs.

Nota Bene
In some paths constants, like:
PHP Code:
define'HOTPROPERTY_BASE'JPATH_BASE DS JPath::clean('components/com_hotproperty') ); 
you can see some '/' in components/com_hotproperty, but no worry, the JPath::clean method substitutes them with the DS value (libraries/joomla/filesystem/path.php line 175):
PHP Code:
// Remove double slashes and backslahses and convert all slashes and backslashes to DS
$path preg_replace('#[/\\\\]+#'$ds$path); 
Hope everything is clear now

Cheers
  #9  
Old 01-05-2009, 04:40 AM
ssaguiar ssaguiar is offline
Mosets'd
 
Join Date: Apr 2008
Posts: 143
Default

Quote:
In other words, DS value is set to:

* '\' when your Joomla runs on Windows
* '/' otherwise
Maybe the problem was because I use xamp as it runs in windows, and, in reality, i's a full server (apache, php and mysql)...??? Just thinking loud....

Quote:
Hope everything is clear now

Cheers
Yep.

Sergio
 

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT +8. The time now is 04:24 AM.

Copyright © 2005-2010 Mosets Consulting

Powered by vBulletin® Version 3.8.6
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.