I have a PHP Page that uses GET, to get parameters from a URL.
So to make that work i have to use the PHP Syntax ‘&’ if I want to use multiple queries.
Example:
www.WEBPAGE/index.php?variableX=1&variableY=2&variableZ=3 and so on.
The Problem is, if I add this link into the assets, it automatically fills it out with &
This “destroys” my PHP script, and it doesn’t get the variable correctly anymore.
Also, everytime I make a change on the Webpage asset, it adds another amp;
Instead of using multiple _GET in my PHP to send parameters, I now use 1 _GET and made an array out of it.
By using the array there is no need to use the char ‘&’.
My Code: values = explode(",", _GET[“id”]);
Then I can just do:
https://my_site/my_php.php?id=VAR1,VAR2,VAR3,VAR4
An with this Screenly no longer adds amp; to my URL!!!
Yeah that’s one workaround. This has however been fixed in the the developer branch so I would encourage you to switch to that one as it has a lot of important fixes/updates.
Hmm yeah, that’s an old device. We might need to drop support for anything older than Pi 3 in the near future, as older devices simply do not have enough RAM to cope with modern web browsers/content. The older releases will of course still be available however.
@RomanCrossIT
You could have also just copied over the few lines from the server.py file from developer/master branch onto the production branch you have installed, this would have fixed that issue.
The changes you would have edited are as follows…
Under this function: def prepare_asset_v1_2
You would change the current code and make the edits below:
ampfix = "&"
name = escape(get('name').replace(ampfix, '&'))
if unique_name:
with db.conn(settings['database']) as conn:
I have copied over the if unique_name: just so that you get a reference point of where the edits should be made by comparing what you currently have vs what I am showing here.
The same goes for the other lines, which are just a few lines down from those I posted above…
uri = (get('uri')).replace(ampfix, '&').replace('<', '<').replace('>', '>').replace('\'', ''').replace('\"', '"')
if uri.startswith('/'):
if not path.isfile(uri):
The important line here being the entire uri = one…
If you make these changes and save that file and reload the screenly-* services, your assets would properly allow for & symbols and it would also fix a naming bug that would duplicate the & when it was part of an assets’ name and this asset was activated, deactivated, and activated again.