vBadvanced Forums  
Go Back   vBadvanced Forums > vBadvanced Products > vBadvanced CMPS > Add-On Modules & Modifications > vBa CMPS v3.x & 2.x > Add-On Modules (version 3.x & 2.x)

Reply
 
Thread Tools Display Modes
  #1  
Old 09-13-2005, 01:45 AM
Gary Bolton's Avatar
Gary Bolton Gary Bolton is offline
Senior Member
 
Join Date: Jan 2005
Posts: 225
Default How to create your own custom modules (CMPS 2.0 RC2)

CREATING NEW CUSTOM MODULES
Using this guide you can create as many new custom modules as you like to display content on your CMPS 2.0 RC2 pages, that are collapsible blocks (Modules)!


STEP ONE:
The first thing you need to do is create a new PHP file that you will be uploading to your Modules Folder. This file is used by your new "adv_portal_custom" template you create so it will be collapsible. Copy the code below into a "notpad.txt" document and re-name the bit's of code I've highlighted in RED to another name that you want your new Block (Module) to be called. For example re-name it to "custom_1" in all 3 places highlighted below. (make sure you have no spaces in your new name) like the second example shows below.


Original Example:

Code:
<?php

$collapseobj_custom = $vbcollapse['collapseobj_custom'];
$collapseimg_custom = $vbcollapse['collapseimg_custom'];

eval('$home[$mods[\'modid\']][\'content\'] .= "' . fetch_template('adv_portal_custom') . '";');

?>
New Example:

Code:
<?php

$collapseobj_custom_1 = $vbcollapse['collapseobj_custom_1'];
$collapseimg_custom_1 = $vbcollapse['collapseimg_custom_1'];

eval('$home[$mods[\'modid\']][\'content\'] .= "' . fetch_template('adv_portal_custom_1') . '";');

?>
Once you have made the changes to the code, use your FTP Program to view and re-name it (you use your FTP Program so you can see the ".txt" extension at the end to change when re-naming). Example here would be re-name it from custom.txt to custom_1.php



STEP TWO:
Now we need to create a new template that will make use of that PHP file we just uploaded to our Modules folder. Go into your AdminCP on your forum and choose the option to add a new template.

Here is the code for the template we use before any changes are made:

Code:
<table align="center" border="0" cellpadding="$stylevar[cellpadding]" cellspacing="$stylevar[cellspacing]" class="tborder" width="100%">
	<thead>
	<tr>
		<td class="tcat">
		<a style="float:$stylevar[right]" href="#top" onclick="return toggle_collapse('custom')"><img id="collapseimg_custom" 

src="$stylevar[imgdir_button]/collapse_tcat$collapseimg_custom.gif" alt="" border="0" /></a>
		<span class="smallfont"><strong>$vba_style[portal_blockbullet] Custom Template</strong></span></td>
	</tr>
	</thead>
	<tbody id="collapseobj_custom" style="$collapseobj_custom">
	<tr>
		<td class="$getbgrow">
<!-- Custom Code Start -->
YOUR CODE GOES HERE BETWEEN THESE LINES
<!-- Custom Code End -->
		</td>
	</tr>
	</tbody>
</table>
<br />
Here is the new example to work with our PHP file above after changing the bits of code highlighted in RED.

Code:
<table align="center" border="0" cellpadding="$stylevar[cellpadding]" cellspacing="$stylevar[cellspacing]" class="tborder" width="100%">
	<thead>
	<tr>
		<td class="tcat">
		<a style="float:$stylevar[right]" href="#top" onclick="return toggle_collapse('custom_1')"><img id="collapseimg_custom_1" 

src="$stylevar[imgdir_button]/collapse_tcat$collapseimg_custom_1.gif" alt="" border="0" /></a>
		<span class="smallfont"><strong>$vba_style[portal_blockbullet] Custom Template 1</strong></span></td>
	</tr>
	</thead>
	<tbody id="collapseobj_custom_1" style="$collapseobj_custom_1">
	<tr>
		<td class="$getbgrow">
<!-- Custom Code Start -->
YOUR CODE GOES HERE BETWEEN THESE LINES
<!-- Custom Code End -->
		</td>
	</tr>
	</tbody>
</table>
<br />
In this new template example you just created, we would now SAVE it as adv_portal_custom_1 to suit our custom_1.php file. So they work together.

You should now have this:
1: custom_1.php (php module file)
2: adv_portal_custom_1 (template file)




STEP THREE:
We will presume that you have already uploaded the "custom_1.php" file to your modules folder, and have created your new "adv_portal_custom_1" template.

In your CMPS settings, choose the option to Add Module. And choose PHP File as the type of module from the list. Then use these settings below.

Main Options
Module Title: Custom 1 (can be anything)
Column: Your choice (left, right, center)
Display Order: 1,2,3,4 etc (your choice)
Active: Yes
Update All Pages: Yes

PHP File Module Options
File to Include: Choose your "custom_1.php" file from the list
Identifier: custom_1 (same name as template and php file with no spaces in the name)
Templates Used: adv_portal_custom_1

Module Shell Template Options
Use Module Shell Template: No (make sure this is NOT set to yes)

These are the only changes you need to make in the settings to add the new module. You can now use this same method to add as many new modules as you wish.
__________________
MRGTB.com

Last edited by Gary Bolton; 09-13-2005 at 01:52 AM.
Reply With Quote
  #2  
Old 12-10-2005, 01:33 PM
cliffdover88 cliffdover88 is offline
Junior Member
 
Join Date: Dec 2005
Posts: 5
Default Re: How to create your own custom modules (CMPS 2.0 RC2)

Say this in the Step three :S

Method Not Allowed
The requested method POST is not allowed for the URL /admincp/vba_cmps_admin.php.


--------------------------------------------------------------------------------

Apache Server at Webname Port 80
Reply With Quote
  #3  
Old 12-14-2005, 03:07 PM
chachu chachu is offline
Junior Member
 
Join Date: Nov 2005
Posts: 17
Default Re: How to create your own custom modules (CMPS 2.0 RC2)

1) very helpful,
2) works like a charm

Although u missed one point to be mentioned, no worries ill do the needfull

if u follow the exact template code mentioned by Gray Bolton
the title of the module will be "Custom Module 1"

to fix tht
in the tempelate find
Code:
<span class="smallfont"><strong>$vba_style[portal_blockbullet] Custom Template</strong></span></td>
and replace the "Custom Tempalte" with wht ever u want the title to be

Last edited by chachu; 12-14-2005 at 03:13 PM.
Reply With Quote
  #4  
Old 12-20-2005, 08:04 AM
capebretoner capebretoner is offline
Junior Member
 
Join Date: Nov 2005
Location: Canada
Posts: 10
Default Re: How to create your own custom modules (CMPS 2.0 RC2)

IS this the same procedure for vBulletin 3.5.x?
Reply With Quote
  #5  
Old 12-20-2005, 09:45 AM
Gary Bolton's Avatar
Gary Bolton Gary Bolton is offline
Senior Member
 
Join Date: Jan 2005
Posts: 225
Default Re: How to create your own custom modules (CMPS 2.0 RC2)

There should be no differnce between using this method to add new modules for vB 3.0 and vB 3.5.
__________________
MRGTB.com
Reply With Quote
  #6  
Old 03-01-2006, 12:48 PM
ashketchum ashketchum is offline
Junior Member
 
Join Date: Dec 2005
Posts: 2
Smile Re: How to create your own custom modules (CMPS 2.0 RC2)

Quote:
Originally Posted by chachu
1) very helpful,
2) works like a charm

Although u missed one point to be mentioned, no worries ill do the needfull

if u follow the exact template code mentioned by Gray Bolton
the title of the module will be "Custom Module 1"

to fix tht
in the tempelate find
Code:
<span class="smallfont"><strong>$vba_style[portal_blockbullet] Custom Template</strong></span></td>
and replace the "Custom Tempalte" with wht ever u want the title to be
LOL! I think he did mention it by putting that piece of text in bold.
Reply With Quote
  #7  
Old 03-03-2006, 08:40 PM
Hurricane Hurricane is offline
Junior Member
 
Join Date: Mar 2006
Posts: 1
Default Re: How to create your own custom modules (CMPS 2.0 RC2)

Very Nice! This worked for me in 3.5.4
Reply With Quote
  #8  
Old 03-25-2006, 10:30 AM
DelfShkrimm DelfShkrimm is offline
Junior Member
 
Join Date: Feb 2006
Posts: 9
Default Re: How to create your own custom modules (CMPS 2.0 RC2)

The code i want to include is php...

So it doesn't work when i include it in the template!

So, how should i do to include php code in a module?
Reply With Quote
  #9  
Old 04-10-2006, 08:17 AM
EvilTT EvilTT is offline
Junior Member
 
Join Date: Mar 2006
Posts: 1
Default Re: How to create your own custom modules (CMPS 2.0 RC2)

Quote:
Originally Posted by DelfShkrimm
The code i want to include is php...

So it doesn't work when i include it in the template!

So, how should i do to include php code in a module?
god i wish someone had an answer for us haha

anyone?
Reply With Quote
  #10  
Old 04-11-2006, 11:05 PM
NR Fatal NR Fatal is offline
Junior Member
 
Join Date: Apr 2006
Posts: 16
Default Re: How to create your own custom modules (CMPS 2.0 RC2)

Quote:
Originally Posted by DelfShkrimm
The code i want to include is php...

So it doesn't work when i include it in the template!

So, how should i do to include php code in a module?

Quote:
Originally Posted by EvilTT
god i wish someone had an answer for us haha

anyone?
I think you'd add your php code into the php file you've created. The copy and paste what he has for the template code he has and then adjust it for your .php file (the filename).

Last edited by NR Fatal; 04-11-2006 at 11:07 PM.
Reply With Quote
  #11  
Old 04-25-2006, 04:00 AM
plateau plateau is offline
Junior Member
 
Join Date: Aug 2005
Posts: 9
Default Re: How to create your own custom modules (CMPS 2.0 RC2)

1.

Quote:
<!-- Custom Code Start -->
YOUR CODE GOES HERE BETWEEN THESE LINES
<!-- Custom Code End -->
how to write the code in between? does it mean that we need also to write the php code by self? or can copy from else where?

Quote:
I think you'd add your php code into the php file you've created. The copy and paste what he has for the template code he has and then adjust it for your .php file (the filename).
cannot get what u mean, sorry. ?

Quote:
Module Shell Template Options
Use Module Shell Template: No (make sure this is NOT set to yes)
i just added a new module called Random Arcade, and if i choose NO in the module shell template options, then the layout of the vba page will be totally wrong.

what does the Module Shell do?

===

thanks in advance anyway.
Reply With Quote
  #12  
Old 05-20-2006, 08:01 PM
sokol sokol is offline
Junior Member
 
Join Date: May 2006
Posts: 10
Default Re: How to create your own custom modules (CMPS 2.0 RC2)

Module shell determines what styles and look are applied to your module, and ANY module that makes use of it.

In other words, making changes to that file will change ALL modules that use it.


-Sokol
Reply With Quote
  #13  
Old 06-02-2006, 05:30 PM
attroll's Avatar
attroll attroll is offline
Senior Member
 
Join Date: Jan 2004
Posts: 818
Default Re: How to create your own custom modules (CMPS 2.0 RC2)

I am confused at what this does? Why would you want to create a custom module this way when you can create a custom page in CMPS or add a module that can do the same thing?

Maybe I don't understand what this does exactly.
Reply With Quote
  #14  
Old 08-19-2006, 09:12 PM
thezman thezman is offline
Junior Member
 
Join Date: Aug 2006
Posts: 9
Default Re: How to create your own custom modules (CMPS 2.0 RC2)

In case anyone is wondering, I followed the directions at the top of this thread exactly as written and it worked fine with 3.6 and 2.2. I even added some code and played around with it and everything worked fine.
Reply With Quote
  #15  
Old 08-25-2006, 09:59 PM
lithlad lithlad is offline
Junior Member
 
Join Date: Jul 2006
Posts: 1
Default Re: How to create your own custom modules (CMPS 2.0 RC2)

Is it somehow possible to use php code inside the custom code block ?
when I try to enter php-code in
Quote:
<!-- Custom Code Start -->
YOUR CODE GOES HERE BETWEEN THESE LINES
<!-- Custom Code End -->
it doesn't get parsed at all.. (checked source, it appears there but it doesn't get parsed)
Reply With Quote
  #16  
Old 08-26-2006, 03:21 PM
bhxtyrant bhxtyrant is offline
Member
 
Join Date: Jul 2005
Posts: 47
Default Re: How to create your own custom modules (CMPS 2.0 RC2)

Hey guys,
This thread has been very helpful to me however i have a question.I wish to make some custom border images for various existing modules such as the navigation block.I was playing around using the above info and that leaves a question.If doing this do i still need to create the first PHP file?Or will i just add the collapse code into the existing modules PHP.

Also how would i define the correct template to collapse for existing modules?Thanks for the time.

Last edited by bhxtyrant; 08-28-2006 at 05:04 AM.
Reply With Quote
  #17  
Old 12-16-2006, 09:11 AM
Designer Designer is offline
Member
 
Join Date: Jun 2005
Posts: 36
Default Re: How to create your own custom modules (CMPS 2.0 RC2)

Quote:
Originally Posted by lithlad View Post
Is it somehow possible to use php code inside the custom code block ?
when I try to enter php-code in
it doesn't get parsed at all.. (checked source, it appears there but it doesn't get parsed)
It wont be parsed as you appear to be writing php into a template, you'd have to put your code into the php file and then whatever data you want to use in the template would have to be stored in a variable or array that way it can be accessed by the template.
Reply With Quote
  #18  
Old 01-26-2007, 10:27 AM
akulion akulion is offline
Member
 
Join Date: Jan 2007
Posts: 34
Default Re: How to create your own custom modules (CMPS 2.0 RC2)

thanks for this tutorial - just what I needed and works perfectly

If you could further clarify just 1 more thing...

Regarding running PHP scripts, since I have many I have made myself, simple little ones and I would like to include them in blocks as well

So could you explain how to do this if possible please?

aku
Reply With Quote
  #19  
Old 01-28-2007, 12:32 PM
Tom_S Tom_S is offline
Old Man
 
Join Date: Jan 2007
Location: Virginia Beach
Posts: 38
Default Re: How to create your own custom modules (CMPS 2.0 RC2)

Thanks...
Reply With Quote
  #20  
Old 02-01-2007, 10:36 AM
iDaemon iDaemon is offline
Junior Member
 
Join Date: May 2006
Posts: 14
Default Re: How to create your own custom modules (CMPS 2.0 RC2)

thanks this is useful
Reply With Quote
Reply


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
I need some advice on how to create custom templates on vBadvanced CMPS badblu "How Do I..." Questions 3 09-11-2005 03:37 PM
How do i create a custom page that will search a custom table/fields in the DB Devices "How Do I..." Questions 2 07-10-2005 04:37 PM
Custom Layout Including CMPS Modules gilbert Add-On Modules & Modifications 2 05-24-2005 01:15 AM
Create custom pages/content Seraphis-XII Troubleshooting / "How do I..." Questions 9 09-12-2004 10:36 AM
create new modules Zedd Troubleshooting / "How do I..." Questions 14 08-14-2004 07:23 PM


All times are GMT -4. The time now is 04:21 AM.

Forums Powered by vBulletin, Copyright ©2000-2009, Jelsoft Enterprises Ltd.
Please note that vBadvanced is in no way affiliated with Jelsoft Enterprises Ltd, nor will Jelsoft be able to provide any support for our products.