Date: 12 January 2008


Assumptions: You know what guibuttons are and have enabled them in your local/config.php. If not see here.

I wanted to add guibutton codes that include reserved characters.

  • Example: the code needed for a +/- show/hide (like the one below for the codelist) starts with:
(:showhide init=hide div=div1 lshow='+' lhide='-':)
which contains single quotes.
1. You cannot use the special characters ' " % @ as text in a php.
  • After a while, I remembered fixing this problem for the % sign and looked around and found that you type %25 to get a % sign.
    • Example: the guibutton code for (:table width='100%' :) is (:table width='100%25' :)
  • I looked and looked for a table of codes for special characters.
    • Finally I found this page The page is beautiful to look at, so incredibly well organized and just what I needed. Thanks!
Open codelist
  • The codes we need are actually in column 3: encodeURI


2. New problem - there is no code for single quote. (I tried %27 without success!)
  • So I tried the code for double quotes, namely %22. This worked.


Guibutton codes

  • Guibutton code for show/hide

$GUIButtons ['show'] = array(695, '(:showhide init=hide div=div1 lshow=%22%%+%22 lhide=%22-%22:)
Show text here\\n(:div1 id=div1 :)\\n', '\\n(:div1end :)\\n>>-<<', Put hidden text here.\\n]',

  • With this, the code will show up in your page with double quotes around the + and -, but this works so who cares.
  • I will try to get a decent gif up this week.
  • Don't forget to change the array number (here it is 695) so that the button appears where you need it to be. (Remember the actual number is not important - the order of the numbers determines the order of the buttons.)
  • Guibutton code for division with a left indent style

$GUIButtons['li'] = array(705,'(:div style=%22margin-left:40px%22:)', '(:divend:)',
' ','$GUIButtonDirUrlFmt/li.gif"$[leftindent]"');

  • Here the css code style="margin-left:40px" is written style=%22margin-left:40px%22
  • Here is my gif for this: (right-click and choose save image; then upload to /skins/guiedit)

$GUIButtons ['advtable'] = array(700, "[table border=1 width=98%25]\\n[row]\\n[!c]Header",
'\\n[tableend]\\n', ' ', '$GUIButtonDirUrlFmt/table.gif"$[Advanced table]"');

  • Here the table width code width=98% is written code width=98%25
  • I just use the standard table gif for this:

 Up one level

Page last modified on December 23, 2008, at 07:00 AM