Recent Topics

1 Feb 03, 2012 19:47    

My b2evolution Version: 4.1.x

Hello all,

I do a Sunday talk radio show and was wondering if there would be a way to write some HTML code (to use in a "free HTML" widget) that would display an image (with link if you click on it) to "Listen Now" to the radio station, but only display it during certain days/hours, i.e. when my radio show is on the air.

Any help much appreciated...I know very little HTML code so please don't assume just giving me a clue will lead me to getting the answer!

Thanks in advance,
Ross

2 Feb 04, 2012 14:03

1.Create a new file named '_onair.php' and paste the below code. It'll create a new widget container just for this purpose


		<?php
			// -------- "onair" CONTAINER EMBEDDED HERE -----
			// Display container and contents:
			skin_container( NT_('onair'), array(
					// The following params will be used as defaults for widgets included in this container:
					'block_start' => '<div class="$wi_class$">',
					'block_end' => '</div>',
				) );
			// -------- END OF "onair" CONTAINER ---------
		?>

2. Insert the below code in your skin where you want it displayed.

<?php

// TUESDAY, 9.30 AM-1PM
$h = date('G');
$m = date('i');
$d = date('w');

if($d == 2 && $h >= 9 && $m >= 30 && $h < 13 && ) {

// ------------- "onair" CONTAINER INCLUDED HERE ---------------
skin_include( '_onair.php' );
// ----------- END OF onair -----------------------

}
?>

3 Feb 04, 2012 14:34

Thanks very much! I'd like to try to clarify a couple of things on implementation.

First, where should I save the onair.php file?

Second, can I implement this so that I can create and move the widget and modify the parameters from within the "widgets" part of the blog settings, the same way I can right now add images or "free HTML" or blogroll, etc?

Thanks again!
Ross

4 Feb 04, 2012 15:06

rossputin wrote:

Thanks very much! I'd like to try to clarify a couple of things on implementation.

First, where should I save the onair.php file?

Second, can I implement this so that I can create and move the widget and modify the parameters from within the "widgets" part of the blog settings, the same way I can right now add images or "free HTML" or blogroll, etc?

Thanks again!
Ross

_onair.php file goes in your ../skins/your_skin folder.
Where do you want to "move" the widgets ? Anything, all the widgets you put in onair container will move on your skin wherever you move your "include _onair.php" code.
Yes you can modify your widget settings like any other free html widget / modify your widget container settings like you would in any other container, as such ..

					// The following params will be used as defaults for widgets included in this container:
				'block_start' => '',
			'block_end' => '',
				'block_display_title' => false,
				'list_start' => '',
				'list_end' => '',
				'item_start' => '<li>',
				'item_end' => '</li>',


You will see a new "container" named 'Onair' in widgets page, like "sidebar, headtop etc"
Anything (image, text etc) you add in "onair" container will display in those hours.


Form is loading...