Mysidia Adoptables Support Forum  

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

Notices

Reply
 
Thread Tools Display Modes
  #1  
Old 09-23-2014, 03:00 PM
FounderSim FounderSim is offline
Member
 
Join Date: Sep 2014
Posts: 65
Gender: Male
Credits: 7,635
FounderSim is on a distinguished road
Default Help creating new pages in ACP

I cant seem to find any proper documentation on how to create modifications for mysidia. Here's what I have tried so far and can't figure out.

I have modified the class/class_page.php get_page to add my :EXPLORE: page the list of ACP pages if its even required.

I have created my explore.php page following the flow of other pages. To keep it simple, i only created the content first to see if it was even going to work which it didnt.

Code:
	public function add(){
	    $mysidia = Registry::get("mysidia");
		$document = $mysidia->frame->getDocument();	
			
		$document->setTitle($mysidia->lang->explore_title);
		$exploreForm = new Form("addform", "add", "post");
		$exploreForm->buildComment("<u><strong>Add new status:</strong></u>")
		               ->buildComment("Status Description: ", FALSE)->buildTextField("textDesc")
					   ->buildComment("Status Chance %: ", FALSE)->buildTextField("textDescPerc")
					   ->buildComment("<b>Add Explore Pet</b>")
					   ->buildDropDownList("adopt", "AdoptTypeList")
		               ->buildComment("Pet %: ", FALSE)->buildTextField("textPetPerc")
					   ->buildComment("<b>Add Explore Item:</b>")
					   ->buildDropDownList("item", "ItemList")
		               ->buildComment("Item %: ", FALSE)->buildTextField("textPetPerc")					   
					   ->buildComment("<b>Coin % Chance: </b>")
					   ->builtComment("Coin Low Amount", FALSE)->buildTextField("textCoinLow")
					   ->buildComment("Coin High Amount: ", FALSE)->buildTextField("textCoinHigh")
					   ->buildButton("Modify Explore", "submit", "submit");
		$document->add($exploreForm);
	}
I found i had to build my own itemList form helper as there was not one already made so i did so in the class_formhelper.php

Code:
	/**
     * The buildItemList method, builds a dropdown list for available items.
	 * @param String  $name
     * @access public
     * @return DropdownList
     */		
	public function buildItemList($name){
        $mysidia = Registry::get("mysidia");
		$itemList = new DropdownList($name);
	    $iids = $mysidia->db->select("items", array("id"))->fetchAll(PDO::FETCH_COLUMN);
		$inames = $mysidia->db->select("items", array("items"), "1 ORDER BY id")->fetchAll(PDO::FETCH_COLUMN);
	    $itemList->add(new Option("No Item Selected", "none"));
	    $itemList->fill($inames, $iids);
		return $itemList;
	}

so since I could not get the page to be displayed at myurl.com/adminacp/explore/add

I decided i would just add the method to another page to see if that was the problem. So i threw my add method into the image.php admin class and went to myurl.com/adminacp/image/add and the same problem continues.

Code:
Internal Server Error

The server encountered an internal error or misconfiguration and was unable to complete your request.

Please contact the server administrator, blahblahblah and inform them of the time the error occurred, and anything you might have done that may have caused the error.

More information about this error may be available in the server error log.

Additionally, a 500 Internal Server Error error was encountered while trying to use an ErrorDocument to handle the request.

I am guessing that i have to somehow register the files or methods before actual using them?

Will the same concept of creating an acp file apply for creating a player file
Reply With Quote
  #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: 19,414
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
  #3  
Old 09-23-2014, 06:25 PM
FounderSim FounderSim is offline
Member
 
Join Date: Sep 2014
Posts: 65
Gender: Male
Credits: 7,635
FounderSim is on a distinguished road
Default

I am using 1.3.3 so what options do I have?
Reply With Quote
  #4  
Old 09-23-2014, 06:52 PM
IntoRain's Avatar
IntoRain IntoRain is offline
Moderator
 
Join Date: Jul 2013
Location: Portugal
Posts: 461
Gender: Female
Credits: 19,414
IntoRain is on a distinguished road
Default

I haven't worked with 1.3.3 in a while now and I don't remember having that error x.x but the page building should be almost the same, for example:

PHP Code:
<?php

class ContestController extends AppController{

    const 
PARAM "contest";
    
    private 
$view;
    private 
$subController;
    
    public function 
__construct(){
           
parent::__construct("member");
           
$mysidia Registry::get("mysidia");
           
                   if(
$mysidia->input->action() != "enter" and $mysidia->input->action() != "index" and !$mysidia->input->get("contest")){
                        throw new 
InvalidIDException("Invalid Action");
        }    
      }
    
    public function 
index(){
        
$mysidia Registry::get("mysidia");
        
$document $mysidia->frame->getDocument();
                
$document->setTitle("Contest");
    
            
        
//stuff
        
                 
    
}
    
        public function 
enter(){
            
$mysidia Registry::get("mysidia");
            
$document $mysidia->frame->getDocument();
            
$document->setTitle("Contest");
            
            
//stuff                  
        
    
}
}
----

Did you try making the content simple before building the form to see if it outputs anything? An alternative way of doing forms is in register.php

Do the other pages work (/image/upload for example) or also spit out an Internal Server Error?
__________________


asp.net stole my soul.
Reply With Quote
  #5  
Old 09-23-2014, 11:22 PM
FounderSim FounderSim is offline
Member
 
Join Date: Sep 2014
Posts: 65
Gender: Male
Credits: 7,635
FounderSim is on a distinguished road
Default

I have commented out all the form building and left only the title code and same error. I have even added another method on another page with the following code:

Code:
           $mysidia = Registry::get("mysidia");
            $document = $mysidia->frame->getDocument();
            $document->setTitle("TEST");
I then try to access it like mysite.com/adminacp/image/add and it errors.
But if i go to mysite.com/adminacp/image/upload it will work.

Every time I think I figure it out. It doesn't want to work. It is starting to get very frustrating.
Reply With Quote
  #6  
Old 09-25-2014, 10:14 AM
FounderSim FounderSim is offline
Member
 
Join Date: Sep 2014
Posts: 65
Gender: Male
Credits: 7,635
FounderSim is on a distinguished road
Default

I am updated to 1.3.4

I got to my explore/add admin acp page and get same error. still no luck and just as confused.

explore.php ACP
Code:
<?php

use Resource\Native\String;

class ACPExploreController extends AppController{

	
	public function __construct(){
        parent::__construct();
		$mysidia = Registry::get("mysidia");
		if($mysidia->usergroup->getpermission("canmanagesettings") != "yes"){
		    throw new NoPermissionException("You do not have permission to manage promocode.");
		}		
    }
	
	public function index(){
	    $mysidia = Registry::get("mysidia");
		throw new InvalidActionException($mysidia->lang->global_action);
	}
	
	public function add(){
	    $mysidia = Registry::get("mysidia");
		//$document = $mysidia->frame->getDocument();	


	}

	
}	
?>
view/exploreview.php
Code:
<?php

use Resource\Native\String;
use Resource\Collection\LinkedHashMap;

class ACPExploreView extends View{


	public function add(){
	    $mysidia = Registry::get("mysidia");
		$document = $this->document;	
		$document->setTitle("TEST");
	}
	
}	
?>
I am still getting the
Quote:
Internal Server Error

The server encountered an internal error or misconfiguration and was unable to complete your request.

Please contact the server administrator, blahblah and inform them of the time the error occurred, and anything you might have done that may have caused the error.

More information about this error may be available in the server error log.

Additionally, a 500 Internal Server Error error was encountered while trying to use an ErrorDocument to handle the request.
Reply With Quote
  #7  
Old 09-25-2014, 11:36 AM
IntoRain's Avatar
IntoRain IntoRain is offline
Moderator
 
Join Date: Jul 2013
Location: Portugal
Posts: 461
Gender: Female
Credits: 19,414
IntoRain is on a distinguished road
Default

Is your .htaccess file inside the ACP folder like this or similar?

Code:
RewriteEngine On
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{HTTP_HOST} ^www\.(.*) [NC]
RewriteRule ^ http://%1%{REQUEST_URI} [L,R=301]
RewriteCond %{REQUEST_URI} !\.(js|css|gif|jpg|png)$ [NC]
RewriteRule ^(.*)$ index.php [QSA,L]
Are the Read-Write-Execute permissions of those files set to 644?

Besides that and the .htaccess, I don't know what's causing that, HoF might be more useful x.x
__________________


asp.net stole my soul.
Reply With Quote
  #8  
Old 09-25-2014, 11:55 AM
FounderSim FounderSim is offline
Member
 
Join Date: Sep 2014
Posts: 65
Gender: Male
Credits: 7,635
FounderSim is on a distinguished road
Default

.htaccess file is 100% identical and file permissions are set to 644.

I already messaged HoF once directing him to this thread. I guess we will see if he comes and responds.
Reply With Quote
  #9  
Old 09-25-2014, 12:34 PM
IntoRain's Avatar
IntoRain IntoRain is offline
Moderator
 
Join Date: Jul 2013
Location: Portugal
Posts: 461
Gender: Female
Credits: 19,414
IntoRain is on a distinguished road
Default

I'm sorry I can't help more, never had that happen to me when creating new pages. Does it happen as well when creating those pages outside ACP?
__________________


asp.net stole my soul.
Reply With Quote
  #10  
Old 09-26-2014, 10:14 AM
FounderSim FounderSim is offline
Member
 
Join Date: Sep 2014
Posts: 65
Gender: Male
Credits: 7,635
FounderSim is on a distinguished road
Default

Ok, So I came to the conclusion I am not so crazy afterall, just frustrated.

Code:
<?php

use Resource\Native\Integer;
use Resource\Native\String;
//use Resource\Collection\HashMap;

class TesterController extends AppController{

	//private $friendlist;

    public function __construct(){
        parent::__construct("member");
		$mysidia = Registry::get("mysidia");			            
    }
	
	public function index(){
	    throw new InvalidActionException("global_action");
	}
	

	
	public function test(){
		$mysidia = Registry::get("mysidia");            
	}
}
?>

Code:
<?php

use Resource\Native\String;
use Resource\Collection\LinkedHashMap;

class TesterView extends View{
		
	
	public function test(){
		$mysidia = Registry::get("mysidia");
		$document = $this->document;  
        $document->setTitle("TEST");
        //$document->addLangvar($mysidia->lang->remove);        
	}
}
?>

These files will work on PLAYER SIDE, but if i change the class names to ACPTesterView and ACPTester and move to correct locations, they will error and provide

Code:
Internal Server Error

The server encountered an internal error or misconfiguration and was unable to complete your request.

Please contact the server administrator, blahblahblah and inform them of the time the error occurred, and anything you might have done that may have caused the error.

More information about this error may be available in the server error log.

Additionally, a 500 Internal Server Error error was encountered while trying to use an ErrorDocument to handle the request.
Reply With Quote
Reply


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 04:59 PM.

Currently Active Users: 9549 (0 members and 9549 guests)
Threads: 4,080, Posts: 32,024, 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 - 2024, vBulletin Solutions Inc.
vBCommerce I v2.0.0 Gold ©2010, PixelFX Studios
vBCredits I v2.0.0 Gold ©2010, PixelFX Studios
Emoticons by darkmoon3636