Page 1 of 4 1234 LastLast
Results 1 to 20 of 63

Thread: How to create your own custom modules (CMPS 2.0 RC2)

  1. #1

    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.
    Last edited by Gary Bolton; 09-13-2005 at 02:52 AM.

  2. #2

    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

  3. #3
    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 04:13 PM.

  4. #4
    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?

  5. #5

    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.

  6. #6
    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.

  7. #7
    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

  8. #8
    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?

  9. #9
    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?

  10. #10
    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-12-2006 at 12:07 AM.

  11. #11
    Join Date
    Aug 2005
    Posts
    9

    Default Re: How to create your own custom modules (CMPS 2.0 RC2)

    1.

    <!-- 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?

    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. ?

    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.

  12. #12
    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

  13. #13
    Join Date
    Jan 2004
    Posts
    820

    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.

  14. #14
    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.

  15. #15
    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
    <!-- 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)

  16. #16

    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 06:04 AM.

  17. #17

    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.

  18. #18

    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

  19. #19
    Join Date
    Jan 2007
    Location
    Virginia Beach
    Posts
    39

    Default Re: How to create your own custom modules (CMPS 2.0 RC2)

    Thanks...

  20. #20
    Join Date
    May 2006
    Posts
    14

    Default Re: How to create your own custom modules (CMPS 2.0 RC2)

    thanks this is useful

Page 1 of 4 1234 LastLast

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Similar Threads

  1. Replies: 3
    Last Post: 09-11-2005, 04:37 PM
  2. Replies: 2
    Last Post: 07-10-2005, 05:37 PM
  3. Custom Layout Including CMPS Modules
    By gilbert in forum Add-On Modules & Modifications
    Replies: 2
    Last Post: 05-24-2005, 02:15 AM
  4. Create custom pages/content
    By Seraphis-XII in forum Troubleshooting / "How do I..." Questions
    Replies: 9
    Last Post: 09-12-2004, 11:36 AM
  5. create new modules
    By Zedd in forum Troubleshooting / "How do I..." Questions
    Replies: 14
    Last Post: 08-14-2004, 08:23 PM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •