Dream Portal is a portal system designed to function with Simple Machines Forum (aka SMF).

It allows you to easily manage your site and webpages in an SMF environment. Place Modules on different actions and non-actions of your SMF forum using a simple drag-and-drop approach. Users can also create and save multiple layouts by name and assign pages to any layout(s). Bundled with Dream Pages and Dream Menu helps put the power and ease of customizing your SMF forum right at your fingertips.

Dream Portal allows you the ability to easily customize your SMF forum and site with many different possibilities helping to make customization truly what dreams are made of!

DreamPortal1.0.5.zip
File size: 221KB
Download count: 1662
DreamPortal1.0.5.tar.gz
File size: 176KB
Download count: 159
Download
Hello, Guest
Please login or register.

 
 
 

Did you miss your activation email?

Re: Menübutton lassen sich nicht löschen.
Last Poster: Tony_R in German on May 14, 2012, 10:18:03 AM


hat mir auch geholfen, vielen dank !

Re: Sologhost went mad. Check this fast!
Last Poster: ThoTh in Chit Chat on May 13, 2012, 03:07:02 PM


Congrats :D

Re: Think I have Everything I need
Last Poster: SoLoGHoST in Chit Chat on May 09, 2012, 01:36:37 PM



Your Recent Image Attachments...
Last Poster: SoLoGHoST in Team Blog on May 07, 2012, 04:13:46 AM


Well, just thought I'd let you all know of the ability to see your 15 most recent image attachments

Re: Inspire Romance
Last Poster: SoLoGHoST in Website Showcase on May 03, 2012, 12:34:22 PM


Looks great!! :)

Author Topic: [WIP] How to Create a DP Module!  (Read 2874 times)

0 Members and 1 Guest are viewing this topic.

SoLoGHoST

  • Lead Developer
  • Developer
  • Constant Sleeper
  • *
  • Posts: 2081
  • Wanted... DEAD or ALIVE!
    • Dream Portal
[WIP] How to Create a DP Module!
« on: February 22, 2011, 05:52:38 PM »
Ok, so in this topic I will discuss all of the files, exactly what should go in them and even provide examples that you can use to Create Your Own Dream Portal Modules that you can upload and install and use throughout Dream Portal and on any page of SMF.

So, here goes...

A module is compressed using the .ZIP or .TAR.GZ format and ONLY supports these 2 formats.

First, let's explain a little on what types of files that Modules are made up of.  That is to say the files that are stored within the compressed ZIP/TAR.GZ file.  There are 4 types of files...

  • info.xml (Mandatory, MUST BE NAMED EXACTLY info.xml) - This file MUST reside within the document root of the ZIP file.  info.xml will handle all of the filepaths for your module upon uploading of the module.  This file is also responsible for many more things throughout the module, such as functions, icons, module's title, and more.  Will be explained in full!
  • Language Files (Mandatory, can be named anything and can reside in any folder within the zips root folder) - These files will hold all of the strings needed for your Module.  This includes regular strings as well as ALL HELP strings as well.  They are separated into UTF-8 and the MAIN language file.  The main ENGLISH language file is CRITICAL and MUST be included with your package or you will not be able to upload your Module, all other language files are optional (including UTF-8 language files).
  • Coding & Misc. Files (Mandatory, can be named anything and can reside in any folder within the zip's root) - Must provide atleast 1 file of where the function(s) are defined that handles the actual module's code for output.  You can provide any type of files, however, the Modules Main function must be within a PHP file, within PHP opening and ending tags.  If your module requires a JS file and/or a CSS file, or ANY OTHER FILE of any other file type, it will be considered a Coding File and fits into this category.
  • Icon Files (Optional, can be named anything, but SHOULD be within its own folder within the root) - These are icon images that you'd like to assign to your module by default.  These are images that you created or obtained permission to use.  They should be approximately 16x16 pixels and in either of these formats:  jpg, gif, and/or png.  You can supply as many icons as you want and they will all be made available to choose from when one modifies the module.

And that is all of the files that you should ever need to add for your modules.  Once you are finished editing and adding all of your files, make sure that info.xml is within the root, and select all files/folders, right click, select "Send To:" and click on Compressed Zip Folder.  Give it an appropriate name, and upload it into the DP Admin via Modules/Add Modules section.

NOW, I will go into great detail on each of the files listed above and how to use them for the creation of a Module...

info.xml
The info.xml file follows the same rule as the package-info.xml file shipped with MODs for SMF.  There are quite a few differences however.  In any case we will explain all XML tags and what you can do with them.  The following code lists an example info.xml file's content:
Code: [Select]
<?xml version="1.0" encoding="UTF-8"?>
<module>
<title>Test Module</title>
<description parsebbc="true">This is a testing module for [url=http://dream-portal.net]Dream Portal[/url]</description>
<version>1.0</version>
<name>testing</name>
<iconsdir>icons</iconsdir>
<icon>testing/music.png</icon>
<file path="scripts/script.php">
<function><main>module_testing</main></function>
<function>module_testing_default</function>
</file>
<file path="scripts/js/test.js"></file>
<file path="images/test.jpg"></file>
<target>_blank</target>
<url>action=testing</url>
<languages>
<english>
<main>english.php</main>
<utf8>english-utf8.php</utf8>
</english>
</languages>
<param name="test_param1" type="large_text">Just some text in here for testing purposes only!</param>
<param name="test_param2" type="select">0:opt1;opt2;opt3</param>
</module>

FYI:  The order of the tags is not important within the <module> tag.

Ok, now let's explain all of these tags:

  • <module></module> - This must be defined for your module that wraps it all up within a tag itself.  Pretty straight-forward.  Make sure to have a closing tag </module> at the very end on the last line within this file.
  • <title></title> - Mandatory tag that specifies the Title of the Module, use any characters you want, remember that this will be stored into the database also.  This specifies the actual Title of your Module, you name it whatever you want, this is unchangeable.
  • <description parsebbc="true"></description> - This lists the description of your module within the Add Modules section once uploaded (MANDATORY TAG), will be directly next to the title of your module that you defined within the <title></title> tag.  Parsing BBC is optional, if you don't need it, than you don't need to specify that attribute of the <description> tag.
  • <version></version> - This tells us what version of this module they uploaded/installed.
  • <name></name> - MANDATORY, this is an extremely important tag, in that everything links to the name that you give it.  All of your $txt and $helptxt array keys will link to this name as well as your icon, if you supply an icon for your module (will be discussed when we get to that part).  Module names MUST BE UNIQUE.  I put in testing for the name, though honestly, it would be a better idea if I made the name like so, instead:  sg_testing (where sg stands for my username initials, SoLoGHoST) because their might already be a module named testing, but probably not a module named sg_testing.  IT IS EXTREMELY IMPORTANT THAT YOU DO NOT GIVE THIS NAME ANY spaces, or special characters.  USE NUMBERS, UNDERSCORES, and LETTERS only for this name please, it can be up to 255 characters long, so it should be able to be as unique as you can make it.  Though, I don't think you need anymore than 25 characters to make this name unique.  Again, in the example above I used "testing" (without the quotes ofcourse) for the <name> tag.  The name you give it here will be crucial to use later on, and this will be explained when we get to those parts of the module.
  • <iconsdir></iconsdir> - OPTIONAL!  This gives us the directory of where all of your icons that are to be installed when this modules gets uploaded are.  Note, when you specify a folderpath for your icons folder within the ZIP, you DO NOT use a beginning slash (/) or an ending slash (/).  This is important, because if you do, the module can not be uploaded.  So remember, no beginning / and no ending slash for folderpaths in here.  In the example my folderpath of where all of the icons I compressed into the zip file that come with this module, is located in the icons directory/folder within the Root of the zip file.  Once uploaded, all icons will be able to be used, and the name of your module gets shown as a category to select from within the Icons section when modifying any module.
  • <icon></icon> - This will tell Dream Portal which icon to use by default for the module.  Remember this can be changed by the Admin when modifying the module.  If you specified a folderpath within an <iconsdir></iconsdir> tag, you have the option to use any of these icons in there, BUT, if you want to use these icons, you MUST specify the name of the module first as the ROOT folder, so in this example we have this:  testing/music.png which will use one of the custom icons that were installed from the compressed zip file within the folder named: icons.  You also have the option of using any of DP's default icons.  If you want to use any of these, simply type in the filename of the icon, no need for a path here.  The following lists icons that you can use for your module by default that come with Dream Portal.  Simply type in any one of these between the <icon></icon> tag and it will load up that DP icon by default for your module, once installed:  bell.png, brick.png, bricks.png, bug.png, cake.png, cal.png, cal-event.png, chart_curve.png. chart_pie.png, clock.png, cog.png, comment.png, comments.png, down.png, eye.png, folder.png, heart.png, help.png, information.png, joystick.png, lock.png, magnifier.png, male.png, music.png, overlays.png, page_white.png, palette.png, pencil.png, photo.png, plugin.png, post.gif, rainbow.png, rosette.png, star.png, stats.png, time.png, transmit.png, user.png, user_female.png, or world.png.
  • TO BE CONTINUED SOMETIME SOON!!  (This could take some time to explain in detail as I am... argg)
#1
***
フリーレンジ
  • Light Sleeper
  • Posts: 128
Re: [WIP] How to Create a DP Module! - March 08, 2011, 10:20:02 AM
If I understand correctly, DP will automatically create a new block when the module is installed?
Nevermind :P
Last Edit: March 08, 2011, 12:10:55 PM by Robby

#2
**
Skhilled
  • Day Dreamer
  • Posts: 66
Re: [WIP] How to Create a DP Module! - March 08, 2011, 10:59:33 AM
Nice tutorial! :)

#3
*
SoLoGHoST
  • Constant Sleeper
  • Posts: 2081
Defining the Language Strings - March 08, 2011, 01:29:07 PM
Thanks Skhilled

I did not yet finish it, but here is a Pic that I put together once that helped people understand how the language strings are defined for my Download System Module.  So, if you want you can download the Download System Module that is within the Module Packages Board and review the info.xml and see how all of the names in there link to everything in this picture, and hopefully you will catch the pattern here and understand how the language strings will need to work for your modules.

Remember all language strings ($txt and $helptxt) get placed within your language files that you have defined within your info.xml file.

Cheers, image attached :)

#4
*
willemjan
  • Constant Sleeper
  • Posts: 1453
Re: [WIP] How to Create a DP Module! - March 09, 2011, 02:45:11 AM
This helps a lot!

#5
**
Skhilled
  • Day Dreamer
  • Posts: 66
Re: [WIP] How to Create a DP Module! - March 09, 2011, 10:34:33 AM
Yes, it does. When I'm good enough to design a module, it will be very handy...LOL

#6
*****
Masterd
  • Heavy Sleeper
  • Posts: 500
Re: [WIP] How to Create a DP Module! - March 14, 2011, 12:50:25 PM
Nice tutorial! :D

#7
****
JaZz
  • Moderate Sleeper
  • Posts: 361
Re: [WIP] How to Create a DP Module! - March 14, 2011, 12:53:16 PM
ahh, lol! now I got my answer how to add and upload my custom icon :p

#8
****
JaZz
  • Moderate Sleeper
  • Posts: 361
Re: [WIP] How to Create a DP Module! - March 14, 2011, 02:54:25 PM
*sigh* :p

<?xml version="1.0" encoding="UTF-8"?>
<module>
        <title>Twitter Display</title>
        <description parsebbc="true">Twitter Display for Dream Portal</description>
        <version>0.1beta</version>
      <name>twitterdisplayer</name>
      <iconsdir>icons</iconsdir>
        <icon>twitterdisplayer/twitter.png</icon>
      <file path="twitter.php">
                <function><main>twitterdisplay</main></function>
      </file>
      <languages>
         <english>
            <main>english.php</main>
            <utf8>english-utf8.php</utf8>
         </english>
      <languages>
</module>

I get the error message that one or more of the paths for the language files are incorrect...but they are in the root of the zip folder :p Currently I am not using them, so can that be the problem? they kinda of just dummy files for now...anyways the module still installs, and the code works fine...but the custom icon is not uploaded, but the path in the module shows the correct reference to the file on the server twitterdisplayer/twitter.png but the folder was never created and the file never copied :( any inputs? :)

#9
*
SoLoGHoST
  • Constant Sleeper
  • Posts: 2081
Re: [WIP] How to Create a DP Module! - March 15, 2011, 02:29:21 AM
Quote
I get the error message that one or more of the paths for the language files are incorrect..

Ok, so looking at the XML code you have <languages> without an closing tag </languages>

Change this:
Code: [Select]
<languages>
         <english>
            <main>english.php</main>
            <utf8>english-utf8.php</utf8>
         </english>
      <languages>

To this:
Code: [Select]
<languages>
         <english>
            <main>english.php</main>
            <utf8>english-utf8.php</utf8>
         </english>
      </languages>


Quote
but the path in the module shows the correct reference to the file on the server twitterdisplayer/twitter.png but the folder was never created and the file never copied  any inputs?

After uploading your module, browse to your SMF Root, than go to: ./dreamportal/module_icons/twitterdisplayer and verify that the image file is in there:  twitter.png.

Let me know your results, k?

Cheers :)

#10
****
JaZz
  • Moderate Sleeper
  • Posts: 361
Re: [WIP] How to Create a DP Module! - March 15, 2011, 03:38:55 AM
lol! I know it was late yesterday, but that was really a huge mistake :p thanks for pointing out the fact I forgot to close the tag :p

#11
****
JaZz
  • Moderate Sleeper
  • Posts: 361
Re: [WIP] How to Create a DP Module! - March 15, 2011, 06:11:45 AM
Worked like a charm when I closed that tag! :) thanks for the input SoLo ;)

#12
*
SoLoGHoST
  • Constant Sleeper
  • Posts: 2081
Re: [WIP] How to Create a DP Module! - March 15, 2011, 02:47:48 PM
Cheers :)

#13
*****
Masterd
  • Heavy Sleeper
  • Posts: 500
Re: [WIP] How to Create a DP Module! - April 07, 2011, 02:16:47 PM
When do you plan to finish this?

#14
*
SoLoGHoST
  • Constant Sleeper
  • Posts: 2081
Re: [WIP] How to Create a DP Module! - April 07, 2011, 11:28:27 PM
Honestly, not sure if it will ever be finished or not.  I do plan on trying to finish this.  But my time these days is EXTREMELY LIMITED.  If someone else would like to finish where I left off, feel free....  perhaps this can be a TEAM EFFORT from all of those who created mods like Robby and/or JaZz?


 

SHOUTBOX NOT FOR SUPPORT!

 Forum Staff