Jump to content


  • Posts

  • Joined

  • Last visited


Everything posted by darksniperx

  1. I am using ajax to get an array of data. I then output the contents of array to the screen. Is there any pagination that will work with array, and without reloading the page. Thank you!
  2. I was thinking of json, but the server what i am trying to do it is running php 5.1.6, but json_encode needs 5.2.0. i wonder if there is anything that i could do, to use one of the following: print_r(), var_dump(), var_export() or anything else, to dump the information on the screen, then grab with ajax and save it as a javascript array. thx.
  3. 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.
  4. 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.
  5. 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.
  6. the issues what with mvc directory rewrite, i figured out the actual path needed the firebug.
  7. 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 file is physically there. Yet i cannot access it.
  8. 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.
  9. As far as i understand, $this refers to current class. Most likely there is an instance of Home class too somewhere. Since there is an instance of home class, calling its function works no problem. This is as far as i can explain it for now.
  10. Edit: Ok, I have figured out what i needed to have: $this->Home->printText('123'); Home is the name of the model, while printText the name of the function.
  11. 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: 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(); } }
  12. 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:
  13. 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?
  14. I cant say if what was the case or not. but it seemed the colorbox was not compatible with jquery 1.4.1 and I have applied 1.3.2 for which it automatically grabs the height, and I dont need to specify it. But thx for the suggestion. I will test the code separately.
  15. 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?
  16. Hi, I am trying to load html page into div via link. here is my code. <a href="?p=index">Main</a> <a href="?p=history">history</a> <div id='content'> <?php if(isset($_GET['p'])) { $p = $_GET['p']; include($p.'.htm'); } else { include('index.htm'); } ?> </div> But the thing nothing happens, I have tried to echo, and that doesn't even get printed out.
  17. I have tried clearing css cashe. No change. Thanks, I completely forgot about firebug. It was layout-liquid.css that was taking precedence.
  18. 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.
  19. I am customizing drupal zen theme. I am trying to set left margin of a div element using css. #sidebar-left { margin-left:20px; } When I test it out nothing happens. Any help would be appreciated.
  20. 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.