Mysidia Adoptables Support Forum  

Home Community Mys-Script Creative Off-Topic
Go Back   Mysidia Adoptables Support Forum > Mysidia Adoptables > Questions and Supports

Notices

 
 
Thread Tools Display Modes
Prev Previous Post   Next Post Next
  #2  
Old 09-23-2014, 06:18 PM
IntoRain's Avatar
IntoRain IntoRain is offline
Moderator
 
Join Date: Jul 2013
Location: Portugal
Posts: 461
Gender: Female
Credits: 23,157
IntoRain is on a distinguished road
Default

In 1.3.4, pages are divided into Controller and View. That means for each new page you need a Controller and a View file. The View is what you show to the user and the Controller is basically treating the information and passing it to the View

For example, your yoursite.com/adopt page is built using the files: adopt.php (controller) and adoptview.php (viewer). All view pages are inside view folders (there are two: one in your mysidia folder, related to player pages, and one inside admincp folder for ACP pages).


To create an yoursite.com/explore page, you need to:

1) Create an explore.php file (same directory as adopt.php, account.php, etc.) with at least these contents:

PHP Code:
<?php

use Resource\Native\String;

//note the name ExploreController. If you wanted a page called mypage it would be MyPageController and the file would be mypage.php
class ExploreController extends AppController{

    
    public function 
__construct(){
        
parent::__construct("member");
    
$mysidia Registry::get("mysidia");
        
    
//use the following three lines to make it admin-only
    
if($mysidia->usergroup->getpermission("canmanageadopts") != "yes"){
        throw new 
NoPermissionException("You do not have permission to access this page.");
    }    
    }
    
    public function 
index(){
        
$mysidia Registry::get("mysidia");
        
        
//this is how you pass stuff to the view file
        
$this->setField("hello",new String("Hello world!"));    

    }
    
}
?>

2) Create an exploreview.php file (inside the view folder with adoptview.php, accountview.php, etc.):

PHP Code:
<?php

//note the name ExploreView. If you wanted a page called mypage it would be MyPageView and the file would be mypageview.php
class ExploreView extends View{
    
    public function 
index(){
    
        
//the view file messes with the document (page content)
        
$mysidia Registry::get("mysidia");
        
$document $this->document;        
            
$document->setTitle("Title Test");//needs a title to work
            
        //this is how you get stuff from the controller
            
$hello $this->getField("hello");
  
          
//add the contents of the variable hello to the document
            
$document->add(new Comment($hello));
    }

    
}
?>
To make a page like yoursite.com/explore/add, you need to add the method add() similar to index(), for both the ExploreController and the ExploreView
This is also the same concept for ACP pages.
__________________


asp.net stole my soul.

Last edited by IntoRain; 09-23-2014 at 06:22 PM.
Reply With Quote
 


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
Creating Image Folder Abronsyth Questions and Supports 0 10-05-2014 09:12 AM
Error when creating new levels v.1.3.3 Hwona Questions and Supports 1 07-14-2014 02:06 PM
Creating the actual site? BunnyWorld Questions and Supports 1 01-05-2013 09:05 PM
Creating my own? konzair Templates and Themes 7 01-26-2011 03:21 AM
[request] website creating :P powerchaos Webmasters Area 3 04-03-2009 04:37 PM


All times are GMT -5. The time now is 10:33 PM.

Currently Active Users: 2745 (0 members and 2745 guests)
Threads: 4,081, Posts: 32,032, Members: 2,016
Welcome to our newest members, jolob.
BETA





What's New?

What's Hot?

What's Popular?


Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2025, vBulletin Solutions Inc.
vBCommerce I v2.0.0 Gold ©2010, PixelFX Studios
vBCredits I v2.0.0 Gold ©2010, PixelFX Studios
Emoticons by darkmoon3636