Jump to content

darksniperx

Members
  • Posts

    113
  • Joined

  • Last visited

    Never

Posts posted by darksniperx

  1. my ajax function:

    function getGroupDataWithAjax(){
    $(document).ready(function() {
      		var data = $.ajax({
      		url: "groupData.php",
      		async: false
    		}).responseText;
    	return data;
    });
    }
    

     

    function in my controller:

    function getGroupData(){
    	$groupData = $this->HomeModel->returnGroups();
    	return	$groupData;
    }
    

     

    what i would like to do, is to call groupData.php with ajax, and store in a variable for later use.

  2. I figured out the issue somewhat.

     

    I am using and mvc design. And when i research it, i found out that i either need to make a library to handle session variables or use cookies. Since i used the code for mvc of tutorial on build your own mvc that i found on some site, its pretty bugged. When i tried cookies, they seem to work, but i will test them out more concretely tomorrow.

  3. I have a header.php which is included to all php files.

     

    Header.php has the following:

    <?php 
    session_start();
    if(isset($_SESSION)|| $_SESSION != null){
    if(isset($_SESSION['message'])){
    	echo '<br />Login status: '. $_SESSION['message'] ;
    
    }
    }
    
    ?>
    

     

    I have a login.php which has header.php included.

     

    <?php
    include header.php
    ...code
    
    if($validate){$_SESSION['message']  = 'Validated';}
    else{$_SESSION['message']  = 'Unautorized';}
    ?>
    
    

     

    when i refresh the page after submit , and check for $_SESSION['message'] it is always empty.

    same thing is i created another php page, included header.php, and when i redirect to it after login.php the session variable is still empty?

     

    Cant figure out why.

  4. I tried:

    <link rel="stylesheet" href="<?php echo dirname(__FILE__); ?>/css/a3.css" type="text/css" />
    

     

    or

     

    <link rel="stylesheet" href="css/a3.css" type="text/css" />
    

     

    I get

    The requested URL /usr/local/www/vhosts/htdocs/application/views/home/css/a3.css was not found on this server.

     

    The file is physically there. Yet i cannot access it.

  5. Yes, Home is object of class home. The MVC that i am using, there isnt much documentation explaining every little detail.

     

    I searched though codes from various tutorials from the same author of MVC until l i came upon that line. And when i modified to work with my model and function it work.

     

    And it also did not required for me to do any includes.

     

    The main issues as i have stated above, i haven't touched php for a couple of years. Thats why it is a little slow for me at this time.

  6. Here is what i did:

     

    <?php
    class HomeController extends Controller {
    
    function __construct() { 
    	$model = new Home();
    } 
    
    function index($id = null,$name = null) {
    
    	$this->set('title',$name.' - First Test page');
    	//$this->set('todo',$this->Item->select($id));
    	$model->printText('123');
    }
    }
    

     

    Here is what it tells me only when i add __construct:

    Fatal error: Call to a member function set() on a non-object in /usr/local/www/vhosts/htdocs/library/controller.class.php on line 21

     

    controller.class.php

    <?php
    class Controller {
    
    protected $_model;
    protected $_controller;
    protected $_action;
    protected $_template;
    
    function __construct($model, $controller, $action) {
    
    	$this->_controller = $controller;
    	$this->_action = $action;
    	$this->_model = $model;
    
    	$this->$model =& new $model;
    	$this->_template =& new Template($controller,$action);
    
    }
    
    function set($name,$value) {
    #this line#		$this->_template->set($name,$value);
    }
    
    function __destruct() {
    		$this->_template->render();
    }
    
    }
    
    

  7. here is what i did:

     

    <?php
    include('home.php');
    class HomeController extends Controller {
    $model = new Home();
    
    function index($id = null,$name = null) {
    
    	$this->set('title',$name.' - First Test page');
    	$model->printText('123');
    }
    }
    

     

    I get the following:

    Parse error: syntax error, unexpected T_VARIABLE, expecting T_FUNCTION in /usr/local/www/vhosts/htdocs/application/controllers/homecontroller.php on line 4
  8. I have done mvc few years back, but forgot most of it.

     

    I am trying out mvc which i have found on the following link: http://anantgarg.com/2009/03/13/write-your-own-php-mvc-framework-part-1/

     

    when i need to access functions of model from controller class. How would i do that?

     

    I have home controller and home model.

     

    model has a function doThis(){...};

     

    How do i execute that function from controller class?

     

     

  9. Hi,

     

    I have the following line:

    $.fn.colorbox({inline:'true', href:'#content-area',width:'700px', height:getHeight() });

     

    From the following code:

    var boxHeight = document.getElementById('content-area').clientHeight;
    function getHeight(){
        boxHeight += 90;
    return  boxHeight = boxHeight + "px";    
    }
    if(boxHeight > 200){
    $(document).ready(function(){
    $.fn.colorbox({inline:'true', href:'#content-area',width:'700px', height: getHeight() });
    });}

     

    jquery fn.colorbox just would not run if I put getHeight() in it. Any ways to go around it or fix it?

  10. There is probably a CSS selector with a higher precedence than the selector you are trying to use.

     

    Use Firefox with the firebug plugin, and inspect that element (the left sidebar) to find out which selector is taking higher precedence.

     

    Actually, there is one other possibility with Drupal - you may have your CSS set to cache. Go to admin->settings->performance (Drupal 6), and see if it is. You can clear your cache there, and any changes you have made may start to work, if there isn't a selector with higher precedence.

     

    I have tried clearing css cashe. No change.

     

    Thanks, I completely forgot about firebug. It was layout-liquid.css that was taking precedence.

  11. Here is the div element, its an id.

     

    <div id="sidebar-left"><div id="sidebar-left-inner" class="region region-left">
              <?php print $left; ?>
            </div></div> <!-- /#sidebar-left-inner, /#sidebar-left -->
    

     

    Although I have no idea what this means 'class="region region-left"'. I have tried to remove it, nothing happends.

  12. It might not like that it is two queries.  (That could potentially return 2 row resources, and I bet MDB2 wasn't designed for that.

     

    I would suggest just breaking it into 2 query() calls.

     

    I think I have already tried that. But I will try again.

     

    Thank you!

     

    I have tryed to run it into 2 query calls, but I dont think I was doing it correctly, would you be able to show me an example.

     

    Than you!

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.