arbolitoloco / Symbiota-light

Forked from BioCache/Symbiota-light to implement a simplified interface for publishing monographies
GNU General Public License v2.0
0 stars 0 forks source link

Replace inline calls for <meta> and styles with single php include #6

Open arbolitoloco opened 5 years ago

arbolitoloco commented 5 years ago

Templating is done manually in this framework, by including header and footer files in each content page. Content pages have their own html, meta, and body tags. That means that a lot of the head content is repeated, and if one would like to change styles radically, it would be tedious and laborious to manually replace each single call in the over 100 pages in this codebase. Thus, each file will now include a call to a styles configuration php file, that will then include the general style calls and appropriate meta tags, such as the ones important for mobile responsiveness and accessibility. This is a somewhat long task.

arbolitoloco commented 4 years ago

Note: page-specific styles and JS will still be called at the page level, and will not be embedded in the style call file for obvious reasons.

arbolitoloco commented 4 years ago

Closed by 17e44a7c6e83b1c9f27eac8d1dd5495f413ae4a6.

Created headinclude.php file with CSS calls, changing relative paths to full paths (to avoid breaking in internal pages):

<link href="/<?php echo $CLIENT_ROOT; ?>/css/base.css?ver=<?php echo $CSS_VERSION; ?>" type="text/css" rel="stylesheet" />
<link href="/<?php echo $CLIENT_ROOT; ?>/css/main.css<?php echo (isset($CSS_VERSION_LOCAL)?'?ver='.$CSS_VERSION_LOCAL:''); ?>" type="text/css" rel="stylesheet" />

Replaced these (and variations...):

<link href="../css/base.css?ver=<?php echo $CSS_VERSION; ?>" type="text/css" rel="stylesheet" />
<link href="../css/main.css<?php echo (isset($CSS_VERSION_LOCAL)?'?ver='.$CSS_VERSION_LOCAL:''); ?>" type="text/css" rel="stylesheet" />

With this:

<!-- Base -->
<!-- Main -->

And after with this:

<?php include_once($SERVER_ROOT.'/headincludes.php'); ?>
<?php include_once($SERVER_ROOT.'/headincludes.php'); ?>
arbolitoloco commented 4 years ago

Plan has changed in coordination with Ed, since Symbiota-Light folder structure has changed a little bit. So, now, the styles, jQuery, and meta tags are included in the /includes/head.php, and a conditional variable for presence of jQuery is added.

Example in [this commit]: https://github.com/BioKIC/Symbiota-light/commit/71d6ae2e6dce0527c8f8b1217c8c3f02313ef79d