What is minimal plugin … I am asking because when I tried to do empty plugin that doesn’t do nothing, I got error. Just wanted to get skeleton of it to be sure I had it right …
so, for example 😊 can I just do this?
<?php
class Plugin_name {
function Plugin_name()
{
}
}
?>
and should I get an error if I do that? Or shouldn’t?
this wasn’t question about error, it was a question about skeleton of a plugin …
must I have in plugin, one class and one function or just class is enough? must I have author name, description and usage? I am curious how does minimal plugin looks like 😊 Cannot find basic example .. ok, those plugins from EE are not complicated, but one basic Hello world would be enough. When I look at plugin development .. there are lots of text, but there is not even one question about basic plugin. What plugin MUST have to work correctly. Functioning of plugin is something I develop myself …
And winning question 😊 why am I so interested in this? I want to do something for my site … and I want to keep it as basic as I can …
There is a “Hello World” on the Plugin Development Page:
<?php
class Hello_world
{
var $return_data = "";
function Hello_world()
{
$this->return_data = "Hello World";
}
}
?>
You’d insert into your templates like: {exp:hello_world}
Look at some examples on the Plugin Addon page as these can be pretty useful in helping you learn the ExpressionEngine API.
Regards,
-greg
So, code like this
<?php
class Hello_world
{
function Hello_world()
{
echo "Hello world!"
}
}
?>
or simple as this
<?php
class Hello_world
{
echo "Hello world!"
}
?>
aren’t OK? Or, are they? That was my question …
When you look at plugin development page, then there si Hello world example … but nowhere writes is that completed working example or not. Mostly, when you look at some explanation on how something work, then there is all way a sample … and there is allways text on how to save that sample and install it …
Imagine you are completly newbie in EE, you see plugin development page and you get it how it should work, but you cannot find anywhere coherent example on HOW to isntall plugin (found it on forum), how should plugin be named (found also in forum that it should be names exactly as class name), and how to build BASIC plugin or do you MUST have function or don’t, is it optional to have this
$plugin_info = array(
'pi_name' => 'Member List',
'pi_version' =>'1.0',
'pi_author' =>'Joe Smith',
'pi_author_url' => 'http://www.example.com/',
'pi_description' => 'Returns a list of site members',
'pi_usage' => Memberlist::usage()
);
or not. OK, in description there write that I “can” put this 😊 so I presume I don’t need to. I am beginning to comprehend what to do, but I never stuck up on complicated things, only on simple things 😊 complicated stuff I do easily. Simple are basics, and if you don’t understand basic structures, then complicated structures became more complicated. This is not problem in understanding PHP, just in basic structure of plugin … remember that I am newbie … 😊 i did create plugin but still I am interested in this information.
Step back and describe what problem you are having. Your skeleton plugin is fine, but yes, you will get errors in the Plugin Manager if you don’t have an info block. You’re new to three things at once here: ExpressionEngine itself, developing add-ons for ExpressionEngine, and PHP. If you follow the Plugin API docs from start to finish, every question you have had is answered, including the required structure, the required naming pattern, etc., but the problem is that you do not yet have a fundamental knowledge of EE or even PHP. You’re going to have a learning curve.
This is not problem in understanding PHP
<?php
class Hello_world
{
echo "Hello world!"
}
?>
Yes, I’m afraid some of it is. This code block is not valid PHP, and has absolutely nothing to do with whether you’re using it as an EE plugin. You are going to have difficulty following the developer’s documentation if you don’t have a fundamental knowledge of PHP.
OK, in EE docs there si a sentence that says that I CAN have info block … so I presume that I shouldn’t get error when I have plugin without it … that was why I asked can I have plugin as stated above or not … plugin that has only class and function and nothing inside and would that throw an error … so I can check am I doing something wrong or not. I had few problems with plugins, and I did upgrade EE to 1.6.4 but wasn’t sure if I did everything right … So I wanted to do most basic plugin that wouldn’t do an error.
And 😊 I did manage to create a small plugin with thanks of community 😊 thank you guys … and as I have mentioned earlier … still learning and hope that I will have that “lightning bulb” moment as Lisa called it, very soon 😊
Packet Tide owns and develops ExpressionEngine. © Packet Tide, All Rights Reserved.