Jump to content

x1nick

Members
  • Posts

    74
  • Joined

  • Last visited

    Never

Profile Information

  • Gender
    Not Telling

x1nick's Achievements

Member

Member (2/5)

0

Reputation

  1. I have the following, which I thought wouldnt work but gave it a go. {foreach from=$this->toolbar_items key=id item=params} {$this->partial('toolbar/item.tpl', array('id' => id, 'params' => params))} {/foreach} Essentially this would output <?php foreach ($this->toolbar_items as $id => $params): ?> <?php echo $this->partial('toolbar/item.tpl', array('id' => $id, 'params' => $params)) ?> <?php endforeach ?> Is this even possible? I must do this a fair few times in all my projects so need to be able to do this! Cheers
  2. Ah thanks, perfect! I knew that was possible as well but it just didnt cross my mind!
  3. No idea what the correct naming is for this... In php you can do things like this $variable = 'my_class_name'; new $variable() or $variable = "class_{$class_name}" new $variable() I want to be able to do something similar in javascript, is this possible? This is my line of javascript which is clearly not going to work, but idx and file will change App.{idx}.{file} = new App.View.{file} Cheers
  4. Answred my own question http://php.net/manual/en/function.call-user-func-array.php Oops might help someone else anyway!
  5. I have a odd one here, two classes and one which calls another class. I want to pass all of the parameters from the array as seperate variables into the next function. Hope my example explains a little better class master { public function __call($name, $args) { second->$name($args); } } class second { public function example($param1, $param2) { } } master->example($param1, $param2); ( i know its not accurate php, but should get the idea of what im trying to do) I need to do something with the following line second->$name($args); Where param1 and param2 will be seperated out Is there a php function which you can tell it the class, method name and pass it an array of parameters? Thanks
  6. All seems to be working perfectly now Thanks
  7. wow, first look it looks perfect. I am assuming I can add more of (?:\ ([A-Za-z0-9]++)(?:\[([A-Za-z0-9 ]++)\]){0,1}){0,1} To increase the number of options within A 1 and A 2 for example. It would just simply re arrange the results of $matches? Thanks
  8. They could be in any order really So yes they are both the same Thanks Nick
  9. Regex isnt my strong point at all. I am writing a bit of a odd templating system where it replaces special HTML like syntax with PHP code Anyway the different types of syntax can include <fw:head> <fw:var name="test"> <fw:var name="test2" format="max"> <fw:var name="test2" format="max date[d M Y]"> Basically format could have one or two options seperated by a space, but options defined within [ ] can have spaces The name field would never have a space There are some others, but think if I can get the regex for these I can figure the rest out myself. Currently I do the following Seperate out all the <fw: possibilities in a string using preg_match_all('/<fw:(.*)>/Uis', $source, $matches); I then loop through the matches this produces looking for spaces using preg_match_all('/"(?:\\\\.|[^\\\\"])*"|\S+/', $matches[1][$i], $options); Im either looking to 1) run this all in one regex statment (would that even be possible) 2) work on the second regex to support eg="eg eg"
  10. I have a default plugin (function($) { $.lsc = function (json) { $.lsc.vars = json; if (json['toolbar']) $.lsc.toolbar (); } //Create essential functions $.extend ($.lsc, { init: function () { //some code }, }); }); This appears to work fine Now when my whole project is in debug mode, a seperate javascript file is loaded with the following (function($) { //Create essential functions $.extend ($.lsc, { toolbar: function () { alert(1); }, }); }); But I get the following error: $.lsc.toolbar is not a function How can I create a plugin and extend in a seperate file with additional functions when my project is in debug mode? I have never written a jQuery plugin before and struggling to get my head round it
  11. Sorry, my browser crashed so that may have caused it.
  12. This should be really simple but I can't get my head round it. Please see the PHP/HTML below. <?php $a = array( 'test' => "'data'" ); $json = json_encode($a); ?> <!DOCTYPE html> <html lang="en"> <head> <meta charset="utf-8"> <title>Unknown Page</title> <script type="text/javascript" src="http://ajax.microsoft.com/ajax/jquery/jquery-1.5.min.js"></script> <script type="text/javascript"> var j = jQuery.parseJSON('<?php echo $json; ?>'); </script> </head> <body> </body> </html> You will notice that data is stored by " then ' I have tried how it is and also with add slashes $a = array( 'test' => addslashes("'data'") ); It either outputs without slashes (which is clearly wrong) var j = jQuery.parseJSON('{"test":"'data'"}'); Or which I cant work out why dosent work var j = jQuery.parseJSON('{"test":"\\'data\\'"}'); Now firebog throws the following error missing ) after argument list How should I be escaping this variable?
  13. I have mysql exported in the following sql format: - CREATE TABLE IF NOT EXISTS `pma_history` ( `id` bigint(20) unsigned NOT NULL AUTO_INCREMENT, `username` varchar(64) COLLATE utf8_bin NOT NULL DEFAULT '', `db` varchar(64) COLLATE utf8_bin NOT NULL DEFAULT '', `table` varchar(64) COLLATE utf8_bin NOT NULL DEFAULT '', `timevalue` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP, `sqlquery` text COLLATE utf8_bin NOT NULL, PRIMARY KEY (`id`), KEY `username` (`username`,`db`,`table`,`timevalue`) ) ENGINE=MyISAM DEFAULT CHARSET=utf8 COLLATE=utf8_bin COMMENT='SQL history for phpMyAdmin' AUTO_INCREMENT=3761 ; -- -- Dumping data for table `pma_history` -- INSERT INTO `pma_history` (`id`, `username`, `db`, `table`, `timevalue`, `sqlquery`) VALUES (2, 'root', 'information_schema', 'FILES', '2010-03-04 19:26:33', 'SELECT * FROM `FILES`') Just as an example anyway. What I need to be able to do, is import this using PHP. Does anyone know of a suitable class for doing this? I could make my own, but I cant quite work out the best way to seperate the queries out? Thanks
  14. I have a iframe which loads a php in the same directory as the html file. This PHP file can take any where from a few seconds to a miniute to execute. While executing it will output basic HTML using the php flush command so the latest data shows everytime the server executes a command. What I want to be able to do is force this iframe while loading to always scroll to the bottom or end of the page to show the latest output. is this possible?
  15. Im looking for a jQuery plugin which allows the user to resize an image using points around the image. My only example I can think of is the one here: http://tinymce.moxiecode.com/js/tinymce/jscripts/tiny_mce/plugins/imagemanager/pages/im/index.html Where when you edit an image, you have the option to resize it. Enter the new width, height and constrain proportions. Does a plugin like this exist?
×
×
  • 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.