Solving a development problem - urlencoding

2014-10-08
By: michael
Posted in: Development
What I'd like to do is a series on how to go about solving problems.  If you read the forums you will see many instances of questions being asked, then the answer being something like "It's fixed in the next release, so update".

Not all of the code in this series will always be current as better ways of doing things always come up.

What I want to look at here is the base process that you, me or anyone goes through in order to solve a problem.

I'm hoping it will help developers new to Jamroom or new to developing start to get some patterns that they can use to solve their own problems.  Which would lead to developing neat stuff.

So here goes:

First thing to remember is: It's not the problem in particular that we're looking at, but rather the methods we use to solve the problem

Second thing to remember is: There is always more than one way to solve a problem.

This problem comes to us from this forum thread:
https://www.jamroom.net/the-jamroom-network/forum/jamroom-developers/14693/in-user-names

The issue is: That albums with foreign characters (non English) in the url were causing the album to not display.  What we need to figure out is Why?.



So the steps are:
  1. figure out where we need to look
  2. figure out what is not working
  3. find a way to make it work
  4. implement that solution.

In this case:
  1. Where to look was the item_album.tpl file
  2. What was not working was the wrong thing was being searched for
  3. To make it work we needed to get the search term into the same format as it was in the database.
  4. We applied the same code that was used when inserting to the database to the search term.

Fixed.
brian
10 Oct 2014 02:56:51PM @brian:
Nice video Michael!

Wanted to add that for developers, Jamroom has a few functions that are really helpful when it comes to URL encoding and Entity encoding:

jrCore_url_string() - use this in place of urlencode() as it handles a wider variety of languages correctly.

jrCore_entity_string() - use in place of htmlentities(), for the same reason ;)

Developer Networks
18 Oct 2014 02:28:40AM @developer-networks:
Cool video!
michael
18 Oct 2014 02:43:27AM @michael:
@b360 Cheers mate. All credit to you for the subject matter. Help me find some other topics too. :)

Share This

Tags