![]() |
|
#1
|
||||
|
||||
|
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') . '";');
?>
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') . '";');
?>
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 />
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 />
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. |
|
#2
|
|||
|
|||
|
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 |
|
#3
|
|||
|
|||
|
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>
Last edited by chachu; 12-14-2005 at 03:13 PM. |
|
#4
|
|||
|
|||
|
IS this the same procedure for vBulletin 3.5.x?
|
|
#6
|
|||
|
|||
|
Quote:
I think he did mention it by putting that piece of text in bold.
|
|
#7
|
|||
|
|||
|
Very Nice! This worked for me in 3.5.4
|
|
#8
|
|||
|
|||
|
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? |
|
#9
|
|||
|
|||
|
Quote:
anyone? |
|
#10
|
|||
|
|||
|
Quote:
Quote:
Last edited by NR Fatal; 04-11-2006 at 11:07 PM. |
|
#11
|
|||
|
|||
|
1.
Quote:
Quote:
Quote:
what does the Module Shell do? === thanks in advance anyway. |
|
#12
|
|||
|
|||
|
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 |
|
#13
|
||||
|
||||
|
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. |
|
#14
|
|||
|
|||
|
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.
|
|
#15
|
|||
|
|||
|
Is it somehow possible to use php code inside the custom code block ?
when I try to enter php-code in Quote:
|
|
#16
|
|||
|
|||
|
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. |
|
#17
|
|||
|
|||
|
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.
|
|
#18
|
|||
|
|||
|
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 |
|
#19
|
|||
|
|||
|
Thanks...
|
|
#20
|
|||
|
|||
|
thanks this is useful
|
![]() |
| Currently Active Users Viewing This Thread: 1 (0 members and 1 guests) | |
| Thread Tools | |
| Display Modes | |
|
|
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 |