Recent Topics

[2.0.x] Free HTML widget

Started by on Sep 11, 2007 – Contents updated: Sep 11, 2007

Sep 11, 2007 19:25    

My b2evolution Version: 1.10.x

Well, I suppose this belongs here, and not in the Skins forum, because my request has to do with the admin interface, not with the widget itself. Just a suggestion, really.

I want to insert a few chunks of HTML in my blog sidebar, and I want to do it via the "Free HTML" widget, so that updating the skin doesn't wipe my changes.

Problem: All of them say "Free HTML"! Editing or merely moving those chunks is a mess via the interface.

There should be a way to change the label (not the title, to appear in the blog page, but the label which appears in the backoffice) so that I can call one chunk, for example, "hit counter", another one, say, "Add to Bloglines", and a third one, "Old blog", and so on.

It can't be hard, right?

Thank you all, I'm really enjoying v2.0.

Sep 11, 2007 19:43

I'm gonna move this to feature request, cos it kinda feels like it fits there.

Nice idea, not sure how easy it'd be to implement though

¥

Sep 12, 2007 02:20

Yah. It says "Free HTML" to every instance of that widget.

Maybe something like the plugins, where we can rename, no, the "Block Title" reflects the widget title.

^^

Sep 12, 2007 21:23

It could (and I think it should) work this way: if I give the widget a title of "AdSense", for example, the backoffice could list it as "AdSense (Free HTML)". Maybe every widget should be listed that way (title first, then type).

Sep 24, 2007 10:03

Crack open inc/widgets/widgets/_free_html.widget.php and change the following section of code ( approx 49 )

	/**
	 * Get name of widget
	 */
	function get_name()
	{
		$this->init_display( array() );
		$title = T_( 'Free HTML' );
		if( $this->disp_params[ 'widget_title' ] )
			$title .= ' ( '.$this->disp_params[ 'widget_title' ].' )';

		return $title;
	}

then meander down to line 72 ish and make the following change

  /**
   * Get definitions for editable params
   *
	 * @see Plugin::GetDefaultSettings()
	 * @param local params like 'for_editing' => true
	 */
	function get_param_definitions( $params )
	{
		// Demo data:
		$r = array(
			'widget_title' => array(
				'label' => 'Widget title',
				'size' => 60,
				'note' => T_( 'This is the name displayed in the widget list' ),
			),
			'title' => array(
				'label' => 'Block title',
				'size' => 60,
			),
			'content' => array(
				'type' => 'html_textarea',
				'label' => T_('Block content'),
				'rows' => 10,
			),
		);

Hit save and hope it works ;)

¥

Sep 24, 2007 14:14

It works.

Please add it to 2.0.2 :p hehehe... so don't have to edit again :p

To the curious, it will appear like this:
Free HTML ( NAMEHERE )

You will have a new field to place the name of your free HTML content:
Widget title (the new field)
Block Title
Block content

This way, you can leave your Block Title empty if needed, yet you will have a widget title so you can differentiate between your "Free HTML" widgets.

:D

Thanks ¥!

Sep 24, 2007 20:01

Yabba, I can't (and probably won't) wait to apply your patch.

I obviously think this should be permanently added to b2evo.

Thank you very much!

Sep 24, 2007 21:50

Well, yes, it definitely works. :)

Sep 25, 2007 02:51

What about use Block title itself as the widget title? Makes sense to me :D

Sep 25, 2007 05:02

Using the Block Title will have limitations, as I mentioned above, there are widgets you do not want to give a "Block Title". Leaving it empty will change nothing.

So having it separately is a better option, Y's once again showed us the future :p


Form is loading...

Advanced CMS – This forum is powered by b2evolution CMS, a complete engine for your website.