Recent Topics

1 Apr 22, 2006 01:03    

Hey, i'm developing a gallery plugin right now, and it needs to load a css file.

Now in the backoffice this is fine because of the event;
AdminEndHtmlHead

But when viewing the blog normally you need to add the css style manually.

Can there be a event that is called by the current skin.

So something like;

<base href="<?php skinbase(); ?>" />
<meta name="author" content="Comprised of work by various authors." />
<meta name="description" content="<?php $Blog->disp( 'shortdesc', 'htmlattr' ); ?>" />
<meta name="keywords" content="<?php $Blog->disp( 'keywords', 'htmlattr' ); ?>" />
<meta name="generator" content="b2evolution <?=$app_version?>" />
<link rel="alternate" type="text/xml" title="RSS 0.92" href="<?php $Blog->disp( 'rss_url', 'raw' ); ?>" />
<link rel="alternate" type="text/xml" title="RSS 1.0 (RDF)" href="<?php $Blog->disp( 'rdf_url', 'raw' ); ?>" />
<link rel="alternate" type="text/xml" title="RSS 2.0" href="<?php $Blog->disp( 'rss2_url', 'raw' ); ?>" />
<link rel="alternate" type="application/atom+xml" title="Atom" href="<?php $Blog->disp( 'atom_url', 'raw' ) ?>" />
<link rel="pingback" href="<?php $Blog->disp( 'pingback_url', 'raw' ) ?>" />
<?php
$Blog->disp( 'blog_css', 'raw');
$Blog->disp( 'user_css', 'raw');
<!--The next bit is the only bit thats added, the above junk is just to show you where it could be inserted-->
$Plugins->trigger_event( 'SkinEndHtmlHead', array() );
?>

That would be great.

Thanks
-balupton

2 Apr 22, 2006 05:39

Sounds good to me.

Are there other event hooks that are useful and should get added, while we'll change all skins anyway?

3 Apr 22, 2006 05:41

Uhh... I'm not following....

EDIT:
Whoops, dang thought this was the same topic i replied to 5 seconds ago ;)

Second Edit:

Now that i know whats going on, nar thats all that i can think of now.
But the only change that i would make to what i mentioned above is make it;
SkinHtmlHead or SkinStartHtmlHead instead of SkinEndHtmlHead

Because the skin would probably want to load the css first then if it wants overide the default css with it's own seeing that it is a skin.

4 Apr 22, 2006 05:47

I think there should be both SkinBeginHtmlHead and SkinEndHtmlHead, so you have the choice if you want to override previous CSS or not.

5 Apr 22, 2006 05:53

But if the skinner really wants to overide the css they'll just include the css after that event, so maybe just have SkinHtmlHead.

Because it's not like the css could get overwritten accidently as it would be like;

.mypluginthing .div {}
.mypluginthing .anotherthing {}

Yer....

6 Apr 22, 2006 07:37

A tag in the head-generator that allows users to instantaneously add groovy or gimmicky tags like "author" or "favicon". I have no use for this at present but if you are into changing skins then you should consider allowing room for custom head tags via a plugin. Maybe something before the css-including stuff like "GroovyUserTagStuff()"?

PS: what the hell is wrong with these forums! I can not type a slash or an apostrophe without firefox thinking I want to search for the next characters I type. My arrow pad does not arrow and I can not copy slash paste from the original post to this one. WTF??? Imagine - please - that I typed in all the official stuff that makes a plugin be a plugin instead of just acting like the dummy that I am. Bleh.

7 Apr 22, 2006 08:12

Edb in firefox look for a option called search as i type or something and disable that. i had the same problem.
[Options->Advanced->General->Begin finding when i begin typing]

And i don't think your on the same track....

This would be used so like for my gallery plugin that displays a gallery inside a post. It will attach the css style for the gallery during the header for the skin.

Heres my gallery's css;

.gallery, .gallery #preview, .gallery .thumbnails, .gallery .img, .gallery .img img, .gallery fieldset, .gallery p {
	margin:0px;
	padding:0px;
}

.gallery {
	width:100%;
	text-align:center;
	margin:5px;
	margin-top:15px;
}

.gallery #preview {
	margin-bottom:5px;
}
.gallery #preview p {
	margin-bottom:0px;
}
.gallery .thumbnails {
	margin-bottom:5px;
}
.gallery .thumbnail {
	float:left;
	margin:3px;
	padding:3px;
}

.gallery .img img {
	<?php 
	if( $GalleryStyle != 'Manager' ) {
		if(strstr($_SERVER['HTTP_USER_AGENT'],'MSIE')) { ?>
			border:1px solid #847A4F;
		<?php } else { ?>
			border:1px solid white;
			outline:1px solid #CCC5AA;
		<?php }
	} else {
		if(strstr($_SERVER['HTTP_USER_AGENT'],'MSIE')) { ?>
			border:1px solid #847A4F;
		<?php } else { ?>
			border:1px solid white;
			outline:1px solid #CCC5AA;
		<?php }
	} ?>
}

.gallery p {
	font-size:9px;
	font-family:Verdana, Arial, Helvetica, sans-serif;
}
.gallery .title {
	font-weight:bold;
	padding-top:3px;
	<?php if( $GalleryStyle == 'Manager' ) { ?>
	color:#847A4F;
	<?php } ?>
}

.gallery .thumbnail .description {
	display:none;
}

.gallery .thumbnail .action {
	color:#990000;
	text-decoration:none;
}
.gallery .thumbnail .action:hover {
	text-decoration:underline;
}
.gallery fieldset {
	border:0px;
}

And triggered via;

	/*
	 * Event handler: Called when ending the admin html head section.
	 *
	 * @param array Associative array of parameters
	 * @return boolean did we do something?
	 */
	function AdminEndHtmlHead( & $params )
	{
		$GalleryStyle = 'Display';
		
		?>
		<link href="<?=$this->location?>gallery_style.php?GalleryStyle=<?=$GalleryStyle?>" rel="stylesheet" type="text/css" />
		<?php if(strstr($_SERVER['HTTP_USER_AGENT'],'MSIE')) { ?>
			<script src="<?=$this->location?>gallery_display_ie.js" language="javascript" type="text/javascript" ></script>
		<?php } else { ?>
			<script src="<?=$this->location?>gallery_display.js" language="javascript" type="text/javascript" ></script>
		<?php } 
		
		return true;
	}
	
	/*
	 * Event handler: Called when ending the skin html head section.
	 *
	 * @param array Associative array of parameters
	 * @return boolean did we do something?
	 */
	function SkinHtmlHead( & $params )
	{
		$this->AdminEndHtmlHead( $params );	
		return true;
	}

Via

<base href="<?php skinbase(); ?>" />
<meta name="author" content="Comprised of work by various authors." />
<meta name="description" content="<?php $Blog->disp( 'shortdesc', 'htmlattr' ); ?>" />
<meta name="keywords" content="<?php $Blog->disp( 'keywords', 'htmlattr' ); ?>" />
<meta name="generator" content="b2evolution <?=$app_version?>" />
<link rel="alternate" type="text/xml" title="RSS 0.92" href="<?php $Blog->disp( 'rss_url', 'raw' ); ?>" />
<link rel="alternate" type="text/xml" title="RSS 1.0 (RDF)" href="<?php $Blog->disp( 'rdf_url', 'raw' ); ?>" />
<link rel="alternate" type="text/xml" title="RSS 2.0" href="<?php $Blog->disp( 'rss2_url', 'raw' ); ?>" />
<link rel="alternate" type="application/atom+xml" title="Atom" href="<?php $Blog->disp( 'atom_url', 'raw' ) ?>" />
<link rel="pingback" href="<?php $Blog->disp( 'pingback_url', 'raw' ) ?>" />
<?php
$Blog->disp( 'blog_css', 'raw');
$Blog->disp( 'user_css', 'raw');
<!--The next bit is the only bit thats added, the above junk is just to show you where it could be inserted-->
$Plugins->trigger_event( 'SkinHtmlHead', array() );
?>

8 Apr 22, 2006 16:01

blueyed wrote:

Sounds good to me.

Are there other event hooks that are useful and should get added, while we'll change all skins anyway?

The only other things i can think of are;
SkinStartBody - AKA Body Header
SkinEndBody - AKA Body Footer

These would be used if i convert my sidebars addon into a plugin.
As in SkinStartBody i would include the actual div layers being used for the side bars.
And in SkinEndBody i would trigger the javascript timer so the detection of the page size timer starts.
The javascript things that would be in the EndBody are there because they need to access a object and if the scripts are in the header then the object does not exist yet and it will fail.

Well this is the current way i'm doing things in lightality, and i really want to find a better way of doing it.

9 Apr 22, 2006 20:33

balupton wrote:

Edb in firefox look for a option called search as i type or something and disable that. i had the same problem.
[Options->Advanced->General->Begin finding when i begin typing]

I'll look for the option, but I see now where I don't have the same problem. Musta been just the way it was for a bit eh?

balupton wrote:

And i don't think your on the same track....

Understood. blueyed asked for hooks that might be appropriate inside a skin and I always thought it'd be nice if the user could easily, perhaps on a blog-specific basis, add whatever metatags they wanted to the head section. For example I use a handful of location tags, but I'm my only blogger. Perhaps each blogger in a multi-blog/multi-blogger application would want those tags to contain their own info? Same goes for a favicon image. One per skin can be added by hacking the skin, but what about doing one per blog - and more importantly doing it via a plugin. There are hundreds of tags one might choose to add, and lots of them are user-specific. In a world gone mad I could even see using author-specific tags on the permalink page for a post in a multi-author blog.

Anyway the only association with where you want to be is blueyed's question regarding other tags appropriate for inside a skin if they're going to change all the skins.

10 Apr 22, 2006 23:27

Yer.

For the favicon thing, isn't the only way you do that by having favicon.ico in your root directory....
But you make it sound like you can do it within the header, and everything else that you mentioned sounds like you can do it in the header as well...

So I guess where all happy with just the SkinHtmlHead, and i'm happy with the other events...

It's enoying because as soon as plugins start taking over the user/skin side of b2evolution then lightality goes out the door...
Because in Lightality I included things called addons which are plugins but just for the user/skin side of b2evo...

11 Apr 23, 2006 02:33

balupton wrote:

For the favicon thing, isn't the only way you do that by having favicon.ico in your root directory....

The original MS method required favicon.ico in the root directory, but that was then. MS, as far as I know, now respects the 'standard' way of doing it, which is with a specific tag calling out any file name.

<link rel="icon" href="http://wonderwinds.com/favicon.ico" type="image/x-icon" />
<link rel="shortcut icon" href="http://wonderwinds.com/favicon.ico" type="image/x-icon" />

The first line is the 'standards' way, the second is the line MS used to like. In this case it came from my root directory, but it doesn't have to be that way. I have a favicon.ico in a folder and I have different .ico files in the root. I was sort of thinking of doing a bit of php in the head to use a different one for each blog - just haven't bother yet. But yeah any hook in the head section will do the deed.

12 Apr 23, 2006 04:00

arrrr so thats what that line did :o

13 May 08, 2006 18:27

Actually y is there;
AdminStartHtmlHead and AdminEndHtmlHead

Shouldn't just
AdminHtmlHead

Be fine, for the reasons i mentioned earlier...

14 May 08, 2006 18:42

There's only AdminEndHtmlHead!

Just in case if there will come AdminBeginHtmlHead someday. And that's not the point of this thread, so please don't go into detail about it.

I'll look into the Skin's hooks later.

15 May 08, 2006 18:49

.... ok i won't

Heres the steps to add the new events;

[b2evo v1.8 - 14/05/2006]

Add [File - \blogs\inc\_misc\_plugins.class.php] [Line - 239]


				'SkinBeginHtmlHead' => '',
				'SkinBeginBody' => '',
				'SkinEndBody' => '',

Add [File - \blogs\inc\_misc\_plugin.class.php] [Line - 491]

	/**
    * Event handler: Called during the display of the Skins's Html Head section.
    *
    * @param array Associative array of parameters
    * @return boolean did we do something?
    */
   function SkinBeginHtmlHead( & $params )
   {
      return false;      // Do nothing by default.
   }
   
   	/**
    * Event handler: Called at the beggining of the Skins's Html Body section.
    *
    * @param array Associative array of parameters
    * @return boolean did we do something?
    */
   function SkinBeginBody( & $params )
   {
      return false;      // Do nothing by default.
   }
   
   /**
    * Event handler: Called at the end of the Skins's Html Body section.
    *
    * @param array Associative array of parameters
    * @return boolean did we do something?
    */
   function SkinEndBody( & $params )
   {
      return false;      // Do nothing by default.
   }


Heres the steps to add the events to the desired plugin;

Add to the desired plugin;

	/**
    * Event handler: Called during the display of the Skins's Html Head section.
    *
    * @param array Associative array of parameters
    * @return boolean did we do something?
    */
   function SkinBeginHtmlHead( & $params )
   {
      //the code
      return true;
   }
   
   	/**
    * Event handler: Called at the beggining of the Skins's Html Body section.
    *
    * @param array Associative array of parameters
    * @return boolean did we do something?
    */
   function SkinBeginBody( & $params )
   {
      //the code
      return true;
   }
   
   /**
    * Event handler: Called at the end of the Skins's Html Body section.
    *
    * @param array Associative array of parameters
    * @return boolean did we do something?
    */
   function SkinEndBody( & $params )
   {
      //the code
      return true;
   }

And to trigger the events in the custom skin;

Add [ File - \blogs\skins\custom\_main.php ; Line - 62 ]

$Plugins->trigger_event( 'SkinBeginHtmlHead', array() );

Add [ File - \blogs\skins\custom\_main.php ; Line - 67 ]

<?php $Plugins->trigger_event( 'SkiBeginBody', array() ); ?>

Add [ File - \blogs\skins\custom\_main.php ; Line - 357 ]

	$Plugins->trigger_event( 'SkinEndBody', array() );

Edit (17/05/2006);
Changed SkinHtmlHead to SkinBeginHtmlHead.

16 May 08, 2006 19:51

Yeah, looks good.

I'll also add the SkinBeginBody and SkinEndBody events in the same commit.

17 May 14, 2006 07:00

I've updated the code in my previous post to include;
SkinHtmlHead, SkinBeginBody, SkinEndBody

As well as the modifications need to apply it to the custom skin.


Form is loading...