Recent Topics

1 May 01, 2015 17:52    

I can see the following code in the subject file:

	<?php
	 	// Add viewport tag if provided:
		if( $params['viewport_tag'] == '#responsive#' )
		{	// We requested a responsive viewport:
			echo '<meta name="viewport" content="width=device-width, initial-scale=1">'."\n";
		}
		else
		{
			echo $params['viewport_tag'];
		}
	?>

But I cannot find out what it's checking with the if statement. I'm assuming that there's a setting in the backoffice for it, but I've yet to locate it. Can anyone point me in the right direction please?

2 01 May 2015 20:33

This is running on 5.2.2 by the way.

4 02 May 2015 10:08

Thanks @mgsolipa,

It's a way of doing it I guess, but it does seem a rather convoluted way of getting there. It's easier to just paste the meta tag straight in there, which is actually what I did initially, until I noticed all the code to handle the same tag further down the file.

What I've actually been doing is try to modify the <head> section to contain all the HTML needed to convert the skin to be one that is fully HTML5 compliant. As I've been doing that, what I'm coming across, is that there is varied mix of settings that can be tuned on the back office, and others that can only be achieved by modifying the PHP header file. The more I look at it, the more I'm beginning to think that a page in the back office dedicated to setting up the <head> file could be achievable. At the moment, it's a bit piecemeal, with various sections of the back office needing modification, as well as that PHP file.

Note: I am slowly beginning to think the skin I'm working with may not be the best choice - it's essentially the same skin I've used since I first installed nearly 10 years ago, and has been carried through every b2e iteration since.

5 02 May 2015 10:36

OK, that answer got me there. All I needed to do was change this section from this...

$params = array_merge( array(
	'auto_pilot'    => 'seo_title',
	'html_tag'      => '<!DOCTYPE html>'."\n"
	                  .'<html lang="'.locale_lang( false ).'">'."\n",
	'viewport_tag'  => NULL,
	'generator_tag' => '<meta name="generator" content="b2evolution '.$app_version.'" /> <!-- Please leave this for stats -->'."\n",
	'body_class'    => NULL,
), $params );

to this...

$params = array_merge( array(
	'auto_pilot'    => 'seo_title',
	'html_tag'      => '<!DOCTYPE html>'."\n"
	                  .'<html lang="'.locale_lang( false ).'">'."\n",
	'viewport_tag'  => '#responsive#',
	'generator_tag' => '<meta name="generator" content="b2evolution '.$app_version.'" /> <!-- Please leave this for stats -->'."\n",
	'body_class'    => NULL,
), $params );

It does still feel like these types of things could be done from within the back office.

For my next trick, I'm going to adapt the array and the rest of the code to include this meta tag.

<meta http-equiv="X-UA-Compatible" content="IE=Edge">

I tried adding it to the 'Custom meta tag/css section' in 'Blog Settings | Advanced', but b2e knocked that back with the message

Tag <meta> may not have attribute http-equiv="..."

6 04 May 2015 07:57

@chris_of_arabia editing core files when you do have more options, is not a good idea. In this case, you should keep _html_header.inc.php as it and edit the skin file, just because the mechanism to do so is already implemented in b2evo, however, you are free to do it on your own way :D

Regarding the <meta http-equiv.. tag, it's beign rejected by the xhtml validator which accepts only "name, content and charset" as parameters of the <meta> tag (even set for Basic security checking here: http://b2evolution.net/man/blogging-permissions). I think the validator is pretty restrictive in this case, I guess it's a security matter.

7 04 May 2015 22:08

@mgsolipa,

What I'm doing is what it says here in index.main.php

// -------------------------- HTML HEADER INCLUDED HERE --------------------------
skin_include( '_html_header.inc.php' );
// Note: You can customize the default HTML header by copying the generic
// /skins/_html_header.inc.php file into the current skin folder.
// -------------------------------- END OF HEADER --------------------------------

That's exactly what I've done, and am modifying that. In my way of understanding the b2e code structure, I'm not touching the core code at that point; that remains exactly where it is for future use.

All I'm looking to do is implement the suggestions shown here in the early part of http://codeguide.co/. As best I'm able to make out, that's not achievable from within the back office, so I have to look to _html_header.inc.php to achieve it. That's assuming I'm not missing something blatantly obvious of course, which remains a distinct possibility... ;-)

As I mentioned above, the skin I'm basing this on has very deep and ancient roots.

Just on the meta tag, I quickly concluded like you that http-equiv is probably restricted for security reasons, which is why I've gone the safer route of adding it to _html_header.inc.php - better that than open the installation to an attack from outside. I've yet to read up on why that might be restricted, though I assume it's for good reason.


Form is loading...