Making core changes outside of the core, A simple tutorial
Also the code block is injecting a hrefs and no follow tags to the link code inserted there, i guess for SEO. Anyways, remove everything that isn't the url itself and enclose those values in single quotes.
In this tutorial, I am going to show you how to easily change a certain aspect of concrete5 without forking out or otherwise editing the core. In this example, I am adding an option to load both jquery1.2.6 and swfobject2.1js from a google CDN. The reasons I wanted to do this is because a.) I don't see the core team implementing this but they are more than welcome to..in fact i hope to encourage it b.) I wanted to somewhat quell minor feature requests for the dev team that a person with a little bit of know-how could implement on their own.. c.) The google hosted version is minified and perhaps even cached by the browser already! I would also bet their CDN's are a bit faster than something I can afford :).
In the example below, I am modifying a core file which resides in the concrete core @
and we are adding a few values to the siteroot/config/site.php file.
Before we get ahead of ourselves here, we are going to understand what we are doing. In this example, we are going to take the above listed file and replicate it 1:1 and place it in a folder which we create that resides at:
note the concrete folder is missing.
Now Concrete5 has a wonderful feature where it will generally look to a local or non-core place for a file to exist, and if it exists there, it will be loaded instead of the concrete5 core file. What this allows us to do is to easily implement changes that would otherwise have to be done in the core in another cms.... well outside the core.
So now that we have our replicated header_required.php file we are going to make a few changes to it.
The changes I elected to make are shown below. I will detail the changes:
What I am doing here is checking the config file to see if GOOGLE_JQUERY is defined, then if it is true (the 1 value, could boolean parse it but this is my code :))...
Then I am loading the url value for HOSTED_JQUERY_URL which is shown below. If I have this set to false, it will load the jquery that is included with concrete5, otherwise it will load the jquery version hosted by google which might even be cached!.
I am doing the same thing below looking to see if GOOGLE_SWF_OBJ is true, and if so I am loading the google hosted swf object, or using a version that is cached by the browser.
and config/site.php added to bottom directly enside closing php statement:
//above is your standard stuff w/ db connection etc define('ENABLE_CACHE', true); //nice to change this when in development define('GOOGLE_JQUERY', true); define('GOOGLE_SWF_OBJ', true); define('HOSTED_JQUERY_URL', 'http://ajax.googleapis.com/ajax/libs/jquery/1.2.6/jquery.min.js'); //remove nofollow tag, concrete5 codeblock is inserting this define('HOSTED_SWF_OBJ_URL','http://ajax.googleapis.com/ajax/libs/swfobject/2.1/swfobject.js');
This gives you the values you need to use the code above. The google part should be agnostic and changed to something like EXTERNAL_JQUERY and EXTERNAL_SWF_OBJ but again since we are writing code for ourselves we can name it whatever we want to :)
Note that there are all kinds of examples of external libraries you can load from:http://code.google.com/apis/ajaxlibs/...
Now with a new release of concrete5 you may want to check to make sure that your code you added above is compatible. In this example it is pretty simple and I don't see concrete5 core team changing the way this loads, but since we understand what the code above does we can adapt it to meet our needs.
Perhaps the above tutorial will ease your bandwidth bill :).
that is what should go in config.