Cidram: Things I should know before creating custom template?

Created on 30 May 2019  路  3Comments  路  Source: CIDRAM/CIDRAM

I've never given much thought about the Access Denied page looks but I've got freetime this weekend. So I've been thinking about creating a custom template page and give it a modern & fresh look. The current looks feels like in the 80's ( no offense 馃槅 ).

I'm probably gonna use Spectre or Bootstrap as CSS Framework. I've seen the default_template file, judging by it creating a custom page is very easy.

I have to create custom page then add to cidram config, am I correct?
If yes, when cidram gets updated will the custom file gets removed?

Question Resolved

All 3 comments

Lol, no offence taken. I'll never shy away from giving something a good try, but end of the day, my forte is more towards PHP and back-end functionality/logic, less towards CSS and front-end design/stylistic stuff. ^.^

I'm probably gonna use Spectre or Bootstrap as CSS Framework. I've seen the default_template file, judging by it creating a custom page is very easy.

Yep; super easy. :-)

(At least, the process, and where to put what, is easy. In terms of actual design.. well.. that depends on the opinion of whoever's doing the designing, I think).

I have to create custom page then add to cidram config, am I correct?

Yep. For creating custom "Access Denied" pages, you'll want to create a page, named like template_name.html, but change the "name" part to something else (it can be whatever you want, but take a note of it, because you'll also use it for the configuration, and possibly elsewhere, depending on whether you stick to making just a custom "Access Denied" page and nothing else, or develop into a fully-fledged custom theme for the front-end as well). The easiest way to do this (from a design perspective, and to save time), is to just copy/paste the template_default.html file, so that you can work from what's already there.

In the configuration, under template_data, there's the theme configuration directive. Change that to the thing you've just taken a note of. For example: If I created a custom "Access Denied" page, using a file named like template_hello.html, I would change the value of theme to hello.

If you do this from the front-end, when you reach that configuration directive, you should see a list of currently installed themes as the available options. If you scroll to the bottom of that list, there's be an option, "Other". If you select other, a new text field will appear, allowing you to manually specify the value (useful for custom themes, seeing as these aren't installed from anywhere, so CIDRAM won't know about them to be able to populate the list automatically with the appropriate value).

If yes, when cidram gets updated will the custom file gets removed?

Nope, the custom file won't get removed. This is, however, one of the reasons that creating a custom file is better than just modifying existing files. Existing files could be overwritten, deleted, replaced, etc whenever CIDRAM is updated. Custom files (or anything that wasn't there to begin with, and that the updater itself didn't create) won't be touched by the updater though. So actually, the way that you're thinking about doing this, is exactly the way I would normally recommend to do this. :-)

If you want, you can also customise the look of the front-end, too (but this is entirely optional, and customising only the "Access Denied" page, ignoring everything else, is perfectly okay).

All you'd need to do, is create a new directory under vault/fe_assets, named using the value noted from before (e.g., in the case of the template_hello.html example, I would need to create a directory, vault/fe_assets/hello), put any modified versions of the files used by the front-end into that directory, and the customisations should appear. Whichever "theme" is cited on the configuration, whenever CIDRAM needs a front-end asset (i.e., one of the HTML files in vault/fe_assets), CIDRAM will firstly look to see whether the file exists in the directory corresponding to that theme. If it exists, that file will be used. If it doesn't exist, the default, original file in vault/fe_assets will be used. (So, customisations can be as big or as small as you want; if parts of the theme are missing, it won't matter, because the default files will be used anyway).

Also, I forgot to mention: Doing it this way, per the above instructions, you'll want to ignore the css_url configuration directive. The css_url configuration directive is used for when you only want to change the CSS file used by CIDRAM to something from somewhere else, without changing any of the actual HTML of the template file. (So, custom themes whereby the customisations are only CSS and nothing else, css_url can be used, and we can ignore the instructions mentioned in my above reply. But, when we want to change more than just CSS, such as any of the HTML content, the instructions mentioned in my above reply are what we'd want).

Marking as resolved.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

eurobank picture eurobank  路  7Comments

Maikuolan picture Maikuolan  路  5Comments

Dibbyo456 picture Dibbyo456  路  5Comments

eurobank picture eurobank  路  3Comments

mikeruss1 picture mikeruss1  路  5Comments