Silex PHP Scripts
Several PHP scripts are included in Silex and can be used in your publications.
Some info about the scripts:
- located in the folder cgi/scripts/ of your Silex server
- the scripts take parameters in the URL, e.g. a_script.php?a_parameter=my value&other_parameter=my other value
- the help page of each script is displayed when you access the script with your browser without any parameter
Here is a list of the scripts included in Silex distribution:
- download.php
- get_resized_image.php
- get_section_preview.php
- index.php
- log_command.php
- print.php
- proxy.php
- rss_browse_folder.php
- upload_preview.php
- upload.php
Download script for Silex
About
cgi/scripts/download.php
This script is useful if you want to put a link in your website, which leads to a file, and you do not want the file to be opened in the browser, but to be downloaded by the user instead.
Here you will find the user guide of Silex, brought to you by Silex Labs.
How to use this script
Put a link on a button or in a text field which leads to this script with the path to the file which should be downloaded by the user, in the URL. For example, if you have the file media/logosilex.jpg in your library, here is the action to put on a button or image in Silex:
onRelease openUrl:cgi/scripts/download.php?initial_name=media/logosilex.jpg
And the action to put in a text field:
[[openUrl:cgi/scripts/download.php?initial_name=media/logosilex.jpg|Click here to download the file]]
The result
The result of these actions, is this download link instead of this direct link.
Get image resized script for Silex
cgi/scripts/get_resized_image.php
This script allows to resize a image in different scale modes : showAll, noBorder or noScale.
inputs (GET) :
* file : the path to the image from Silex root dir (required)
* scale : scale mode, showall or noborder or noscale (if not specified, showall by default)
* width : the width of the result thumb (cannot be 0 or negative, keep width from source image if not specified)
* height : the height of the result thumb (cannot be 0 or negative, keep height from source image if not specified)
Get section preview script for Silex
cgi/scripts/get_section_preview.php
Author: lexa and Thomas Fétiveau (thomas.fetiveau.tech@gmail.com) alias Zabojad
get_section_preview.php
This script allows get a resized preview image for the given page, in different scale modes : showAll, noBorder or noScale.
inputs (GET) :
* id_site : the name of the site, i.e. the name of the folder in contents/ (required)
* page : the name of the page, i.e. the name of the xml file (without extension) in the folder contents/[id_site]/ (required)
* scale : scale mode, showall or noborder or noscale (if not specified, showall by default)
* width : the width of the result thumb (cannot be 0 or negative, keep width from source image if not specified)
* height : the height of the result thumb (cannot be 0 or negative, keep height from source image if not specified)
Log command srcipt for Silex
This script should be made a plugin
It is not functional anymore
This script adds text at the end of a file. The parameters are
- message or htmlText_str (for compatibility with send_text command)
- logFileName
Print ‘popup’ script for Silex
About
cgi/scripts/print.php
This script let you display HTML formated text in a popup so that the user can print it.
How to use this script
In Silex, use the send_text action, which sends a text component’s text to a script (for printing or send by mail).
Parameters
- scriptUrl_str
- script url, here you want to use cgi/scripts/print.php
- target_str
- target window, here you want to use _blank
- isHtml_str
- use true if your text is HTML formated and false if you send raw text
- params_str
- parameters for the script, here you can use “url_str=URL OF YOUR SILEX PAGE” where “URL OF YOUR SILEX PAGE” is the URL where is your text, url encoded
For example
onRelease send_text:cgi/script/print.php,_blank,true,<<a_text_component_ame.htmlText>>,url_str=<<urlencode silex.rootUrl>>
See the help of the send_text action
To do
- allow parameters in the url, not only in post?
Proxy script for Silex
About
cgi/scripts/proxy.php
This script was started with the help of PHP proxy for FLash cross-domain security problems. It takes a “url” parameter, which is a file you are trying to reach from a Silex connector. If you’re trying to load a file or feed from another site, then you should use this script in order to avoid the crossdomain.xml problem.
How to use this script
In a connector URL, use this URL
<<silex.rootUrl>>cgi/scripts/proxy.php?url=http%3A%2F%2Fwww.google.com%2F
instead of this one
http://www.google.com/
Here, http%3A%2F%2Fwww.google.fr%2F is the url encoded version of http://www.google.com/ and I use this free online tool to do the conversion.
The result
This is google with proxy and this is without proxy
Browse folder script of Silex
You need to provide the path of the folder you want to browse to browse like this
cgi/scripts/rss_browse_folder.php?folder_path=media or cgi/scripts/rss_browse_folder.php?folder_path=media&recursive=true
The parameters are the following
- folder_path
- recursive
- reverseOrder (any value – if defined it reverses the order)
- orderBy (item name, item last modification date, item size, item type, item width, item height, folder, ext)
- allow_folder – true or false – default is false
- allow_file – true or false – default is true
- extension – filter for the extension – default is ”
resulting rss feed has these item tags
- title = file name
- type = file or folder
- extension = file extension
- name = file name without extension
- pubDate = file last modification date
- link = url of the file
- media:content
– fileSize
– type= (e.g. image/jpeg)
– width
– height
– url
Look at :





Or login with :
Enter your WordPress.com blog URL
http://.wordpress.com
Proceed