Customization 3.0

From SubjectsPlus
Revision as of 13:37, 8 August 2015 by Agdarby (Talk | contribs) (Created page with "==Basic== ===Theming or Customizing the Front End=== ====Customizing existing files==== The quickest way to customize SubjectsPlus to match your own website is to a) change...")

(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to: navigation, search


Theming or Customizing the Front End

Customizing existing files

The quickest way to customize SubjectsPlus to match your own website is to a) change the header and footer in subjects/includes/ and b) Tweak the text in the files in /subjects/ as you see fit. Text that is run through Gettext, to make it available for internationalization (see Internationalization 1.0) looks like this:

_("Newest Databases")

In the front end, most text has been done this way, but something might have slipped between the cracks. When SubjectsPlus sees text like this, it checks to see if another language has been set, and then looks in the files for that language to find a match. If there is no language set, or no matching text, it just displays what is inside the quotation marks, i.e., the English text.

If you want to change the text, go ahead! You can either: Just write in whatever text you want, and drop the Gettext function; or write the text inside the function. If you are doing a site in English, it doesn't really make a difference, unless you'd like to share the front end code you have done--then you might want to use the Gettext so your text can later be translated. If you are doing a site in French, you could just write in the French directly, you could put the French inside the Gettext (which would make for some fun if you share the code, because then your poor translator would be working with both English and French text), or you could write in English, and THEN do a translation for the text! This last step seems like a lot of work, but maybe you want to share your awesome new page.


If you are making extensive changes to the layout or coding of a public page, you might want to consider doing a theme. We're just starting to build out this functionality, but to create a new theme you would:

  • Create a new subfolder under subjects/themes/ Here at U of Miami we have a subjects/themes/um/ folder, because our pages are quite different from the default.
  • Copy in any files from the subjects/ folder that you want to customize. So now you might have, say, subjects/themes/yourlibrary/faq.php
  • Customize the new faq.php page until it's just so
  • Go to the SubjectsPlus back end, Admin > Config Site. In the right column, towards the bottom you will see Use a Theme

File:Use a theme.jpg

  • Enter the name of your new theme folder in here (e.g., yourlibrary) and save
  • Now instead displaying, say, subjects/faq.php, it will display subjects/yourlibrary/faq.php

Note #1: the exception, right now, is guide.php--this is too complex a file to easily theme because it draws heavily on other files in lib/SubjectsPlus/Control . In version 4 we might make this possible/easier...

Note #2: If you want to theme some of your files, but not all, you can go into the parent file, e.g., subjects/faq.php and look for the following line

// If you have a theme set, but DON'T want to use it for this page, comment out the next line

if (isset($subjects_theme) && $subjects_theme != "") { include("themes/$subjects_theme/faq.php"); exit;}

Per the instructions, comment out this line--it won't check for a theme. Similarly, if you DO want to override the guide.php, you can add this line (but entering guide.php in place of faq.php) to an appropriate spot in the parent guide.php file.

I want more options in the CKEditor WYSIWYG boxes

You can modify line 42 in CKEditor/config.js. Check out the CKEditor docs for all your options. You might need to clear your browser cache in order to see the changes. }

More information coming soon . . . look at the docs for version 2.x for now. Customization 2.0


Creating a Custom Pluslet


Adding a configuration to the Edit Config screen

You probably don't want to do this, and if you do you might want to do a pull request to add it back into SP's core development...

Add your new item to the $lobjConfigOptions array in control/edit-config.php. E.g.,

"target_blank" => array( _( "Have database links show in new tab" ), "", "boolean", "right", "small", "" , "" ),

Add a line to your includes/config-default.php file (which will be used to create the config.php)

// Open database links with a target=blank

$target_blank = TRUE;

If you have already got SP installed, you'll need to manually add the same line to config.php (which is generated by config-default.php)

// Open database links with a target=blank

$target_blank = TRUE;

And then you will need it to actually do something in your application....