Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8703895
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 13, 20262026-06-13T02:58:08+00:00 2026-06-13T02:58:08+00:00

I’ve created my cakephp website and now would like to create a mobile version

  • 0

I’ve created my cakephp website and now would like to create a mobile version of it. I have followed questions on here and other pages on creating a mobile site. However after implementing the code the page doesn’t load and just shows a blank white page with no title etc.

here is the code in my appcontroller

App::uses('Controller', 'Controller');

class AppController extends Controller {

    public $components = array(
        'DebugKit.Toolbar',
        'Session', 
        'Auth'=>array(
            'loginRedirect'=>array('controller'=>'users', 'action'=>'login'),
            'logoutRedirect'=>array('controller'=>'users', 'action'=>'login'),
            'invoiceRedirect'=>array('controller'=>'invoices', 'action'=>'viewinvoice'),
            'authError'=>"You can't access this page",
            'authorize'=>array('Controller')
        )
    );

    public function isAuthorized($user){
        return true;
    }

    public function beforeFilter(){
    $this->Auth->allow('index','view');
    $this->Auth->allow('about_us','view');
    $this->Auth->allow('contact_us','view');
    $this->Auth->allow('privacy','view');
    $this->Auth->allow('','');
    $this->Auth->allow('forgotten_password','view');

    if ($this->request->isMobile()){
    $this->is_mobile = true;
        $this->set('is_mobile', true );
        $this->autoRender = true;
}
    $this->set('logged_in', $this->Auth->loggedIn());
    $this->set('current_user',$this->Auth->user());

    }

    function afterFilter(){
        // if in mobile mode, check for a valid view and use it
    if (isset($this->is_mobile) && $this->is_mobile) {
        $view_file = file_exists( 'Views' . $this->name . DS . 'mobile/' . $this->action . '.ctp' );
        $layout_file = file_exists( 'Layouts' . 'mobile/' . $this->layout . '.ctp' );
        if($view_file || $layout_file){
            $this->render($this->action, ($layout_file?'mobile/':'').$this->layout, ($view_file?'mobile/':'').$this->action);
        }
    }
     }

    public function pdo_error(){
        $this->set('title_for_layout', 'Error');
        $this->set('stylesheet_used', 'homestyle');
        $this->set('image_used', 'eBOXLogoHome.jpg');   
        $this->layout='home_layout';

    }

}

here is my login function

public function login(){
    //allows users to log in to the website
        $this->set('title_for_layout', 'Welcome to eBox: Innovative Invoice System');
        $this->set('stylesheet_used', 'homestyle');
        $this->set('image_used', 'eBOXLogoHome.png');
        $this->set('comp', 'comp.jpg');
        $this->layout='homepage';

        //if the information is posted to the database      
        if ($this->request->is('post')){
            //and matches correctly to the database
            if ($this->Auth->login()){
            //matches the data to the database
            $username = $this->request->data['User']['username'];
            //get the users User.access_level
            $acl= $this->Auth->User('access_level');

                    switch($acl){

                            case 1:
                            //if the access_level=1 redirects user to Eboxs/home_employee
                            $this->redirect( array('controller' => 'Eboxs','action' => 'home_employee'));
                            break;

                            case 2:
                            //if the access_level=2 redirects user to Eboxs/home_admin
                            $this->redirect( array('controller' => 'Eboxs','action' => 'home_admin'));
                            break;


                            default:
                            //if the access_level=anything else redirects user to Eboxs/home
                            $this->redirect( array('controller' => 'Eboxs','action' => 'home'));
                            break;

                        }

                    }   

        else{

        }
    }else{

    }


}

here is my mobile.ctp layout

<?php echo $this->Html->docType('xhtml-trans'); ?>
<html>
<div id = "header" style="background-image:url(<?php echo $this->webroot; ?>img/BannerGradient2.jpg);">
<head>

    <title>hi</title>
    <?php echo $this->Html->css($stylesheet_used); ?>


<?php echo $this->Html->image($image_used, array(
    "alt" => "eBox",
    'url' => array('controller' => 'Users', 'action' => 'login'))) ?>



</head>
</div>

<body>

        <?php echo $this->Session->flash(); ?>
        <?php echo $this->fetch('content'); ?>
</div>      

<div id="footer">
                        <p align= center>
                        <?php echo $this->Html->link('About Us', array('controller' => 'eboxs', 'action'=>'about_us')) ;?> 
                        | 
                        <?php echo $this->Html->link('Contact Us', array('controller' => 'eboxs', 'action'=>'contact_us')) ;?>  
                        | 
                        <?php echo $this->Html->link('Privacy', array('controller' => 'eboxs', 'action'=>'privacy')) ;?> 

    </div>
</body>
</html>

here is my login.ctp file

 <table id ="loginform">

          <?php echo $this->Form->create('User', array('url' => array('controller' => 'users', 'action' => 'login')));?>

        <td><text6><?php echo  "Username"?></text6></td>

        <td><?php echo $this->Form->input('username',array('label'=>false,'size'=>7));?></td>

        <td>&nbsp;</td>

        <td>&nbsp;</td>

        <td><text6><?php echo  "Password"?></text6></td>

        <td><?php echo $this->Form->input('password',array('label'=>false,'size'=>12));?></td>

        <td><?php echo $this->Form->end('Login');?></td>

    <tr>

        <td></td>

        <td></td>

        <td></td>

        <td></td>

        <td></td>

        <td><text6>Forgot your password?</td>

        <td><?php echo $this->Html->link('Click Here', array('action'=> 'forgotten_password')) ;?></td>

    </tr></text6>

    </table>

im just trying to create a simple login page. I’m using cakephp 2.0

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-13T02:58:10+00:00Added an answer on June 13, 2026 at 2:58 am

    i’ve added this code to my controller and works well

    public function login(){
        //allows users to log in to the website
            $this->set('title_for_layout', 'Welcome to eBox: Innovative Invoice System');
            $this->set('stylesheet_used', 'homestyle');
            $this->set('image_used', 'eBOXLogoHome.png');
            $this->set('comp', 'comp.jpg');
            if($this->request->isMobile()){
            $this->layout='mobile';
            }
            else{
            $this->layout='homepage';
            }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a string like this: La Torre Eiffel paragonata all&#8217;Everest What PHP function
I would like to count the length of a string with PHP. The string
this is what i have right now Drawing an RSS feed into the php,
I would like to run a str_replace or preg_replace which looks for certain words
I know there's a lot of other questions out there that deal with this
I would like my Web page http://www.gmarks.org/math_in_e-mail.txt on my Apache 2.2.14 server to display
I have a .ini file as follows: [playlist] numberofentries=2 File1=http://87.230.82.17:80 Title1=(#1 - 365/1400) Example
Basically, what I'm trying to create is a page of div tags, each has
link Im having trouble converting the html entites into html characters, (&# 8217;) i
I have just tried to save a simple *.rtf file with some websites and

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.