Results 1 to 10 of 10

Thread: n2lbr isn't outputting correctly

  1. #1
    Join Date
    Feb 2005
    Location
    London, ON
    Posts
    241

    Default n2lbr isn't outputting correctly

    I have one agent field called position where I have a multiple select list. When 2 choices are selected, n2lbr is using <br> rather than <br />, so I am getting validation errors.

    What's really strange is that the number of errors changes based upon the age of the entry. The newest one has only 3 errors; 2 of which are the n2lbr, and the third is when displaying listing_agent_field_homepage, which returns an incorrect target value of _new. Looking at the code, which I think was user.inc.php, the url should display _blank.

    If you look on my site, 83 Inwood is the newest. I'm stumped on this one.

    I found an interesting read about that here.

    Thanks,
    Louis
    Real Estate Auctioneer

    Joomla Practice Site
    http://demo.corporateone.ca

  2. #2
    Join Date
    May 2004
    Location
    Long Island, NY
    Age
    49
    Posts
    9,796

    Default Re: n2lbr isn't outputting correctly

    nl2br is not used on multiple select fields. There was one function left in user.inc.php using <br> which is now fixed in SVN.

    There are no functions in user.inc.php that output URL's like you have. OR uses an onclick command on all user field URL's to open them in a new window.

    Maybe the link is coded in your template file?

  3. #3
    Join Date
    Feb 2005
    Location
    London, ON
    Posts
    241

    Default Re: n2lbr isn't outputting correctly

    Thanks pb!

    The line in user.inc.php is 412. Is that the one that creates the caption and link to the agent's homepage? It reads correctly with _blank, but when I went to the W3C validator, it came up with _new.

    I'll grab the other file from svn .... thanks!
    Real Estate Auctioneer

    Joomla Practice Site
    http://demo.corporateone.ca

  4. #4
    Join Date
    May 2004
    Location
    Long Island, NY
    Age
    49
    Posts
    9,796

    Default Re: n2lbr isn't outputting correctly

    Your page is outputting:

    <span class="field_caption">Website</span>:&nbsp;<a href="http://corporateone.ca" target="_new">http://corporateone.ca</a>

    If the link was being created by OR it would look lke this:
    <span class="field_caption">Homepage</span>:&nbsp;<a href="http://www.pbflash.com" onclick="window.open(this.href,'_blank','location= 1,resizable=1,status=1,scrollbars=1,toolbar=1,menu bar=1');return false">http://www.pbflash.com</a><br />Notice that your link is missing the onclick attribute. This leads me to believe that you are using a modified user.inc.php, an older version of the file, or you are outputting the raw value in your template and coding the link yourself.

  5. #5
    Join Date
    Feb 2005
    Location
    London, ON
    Posts
    241

    Default Re: n2lbr isn't outputting correctly

    Hi Pb,

    It's possible that the file wasn't fully updated with the 2.3.1 release, when I uploaded it, but I made 2 revisions to the file. First, I added a class to <ul>, and second changed a table width to 540. Neither of these should have any effect on parsing the url.

    Here is that portion from mainjavarows:
    <td valign="middle">
    {listing_agent_field_phone}<br />
    {listing_agent_field_fax}<br />
    {listing_agent_field_homepage}
    </td>
    I grabbed the svn update and updated the user.inc.php file, and both the n2lbr and website problems are still there. I never made any revisions to that file. Is it possible that the website link is being generated elsewhere? It sure looks like that file, but I haven't changed anything there.
    Real Estate Auctioneer

    Joomla Practice Site
    http://demo.corporateone.ca

  6. #6
    Join Date
    May 2004
    Location
    Long Island, NY
    Age
    49
    Posts
    9,796

    Default Re: n2lbr isn't outputting correctly

    As I mentioned above:
    nl2br is not used on multiple select fields
    This is not a problem with nl2br. If you look at the renderSingleListingItem function (which is the function that outputs these fields) in user.inc.php (SVN version) you should see the following:

    if ($field_type == "select-multiple" OR $field_type == "option" OR $field_type == "checkbox") {
    // handle field types with multiple options
    // $display .= "<br><b>$field_caption</b>";
    $feature_index_list = explode("||", $field_value);
    sort($feature_index_list);
    foreach($feature_index_list as $feature_list_item) {
    $display .= "<br />$feature_list_item";
    } // end while
    } // end if field type is a multiple type




    elseif ($field_type == "url") {
    $display .= "<a href=\"$field_value\" onclick=\"window.open(this.href,'_blank','location =1,resizable=1,status=1,scrollbars=1,toolbar=1,men ubar=1');return false\">$field_value</a>";

    As you can see, a <br /> tag is used for multiple select fields and URL's are generated with an onclick function to open the url in a new window.

    I also did a search on every include file and there is no code that is output to the listing view that uses a <br> tag or _new.

    If you are getting the updates from SVN, make sure they are being uploaded to your server.

  7. #7
    Join Date
    Feb 2005
    Location
    London, ON
    Posts
    241

    Default Re: n2lbr isn't outputting correctly

    Woo hoo! Tortoise just didn't seem too happy, so I created a new svn folder, and checked out again, and now it's perfect!

    Did you see my other post about validation? Older entries keep coming up with malformed uri warnings. Please look at this one:
    http://corporateone.ca/component/option,com_mamboor/Itemid,71/openrealty,616374696f6e3d6c697374696e6776696577266 16d703b6c697374696e6749443d38/
    I don't know if this is because of stored data from when the listing was created. I changed hosts around December of last year, and they were running an older version of mysql, so I had to re-enter every listing. I think OR might have been around 2.2.0 or so then.

    Thanks for your help Pb!!
    Real Estate Auctioneer

    Joomla Practice Site
    http://demo.corporateone.ca

  8. #8
    Join Date
    May 2004
    Location
    Long Island, NY
    Age
    49
    Posts
    9,796

    Default Re: n2lbr isn't outputting correctly

    That link doesn't bring anything up.

  9. #9
    Join Date
    Feb 2005
    Location
    London, ON
    Posts
    241

    Default Re: n2lbr isn't outputting correctly

    Sorry about that, I'm just installing openSEF. I got this working well on my demo site last night, and now I'm doing the live site. If you would, just click to view all listings, and select 213 Vimy Ridge.

    That openSEF for Joomla works really well! You have to disable the Joomla rewriting in .htaccess, and enable the third party rewriting. Then enable the SEO and dynamic parts in the Joomla configuration, and it will work slick.

    That link should work now, and you'll be redirected to the new url.
    Real Estate Auctioneer

    Joomla Practice Site
    http://demo.corporateone.ca

  10. #10
    Join Date
    Feb 2005
    Location
    London, ON
    Posts
    241

    Default Re: n2lbr isn't outputting correctly

    Hi Pb,

    OpenSEF is working correctly now. The last listing that I entered, http://corporateone.ca/83_Inwood_Cr
    validates perfectly, as does the second last, but no other listing does. Is this a matter of cleaning the database of old entries?

    On further investigation, this may be one of two listings where I didn't add any text to the image description fields or captions. I had previously changed the alt to be the thumbnail name, since mainjavarows doesn't use captions, and that fixed some warnings.

    I just crashed my site trying to verify this, or the server went down.
    Real Estate Auctioneer

    Joomla Practice Site
    http://demo.corporateone.ca

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •