-
Posts
291 -
Joined
-
Last visited
-
Days Won
1
mentalist last won the day on October 27 2013
mentalist had the most liked content!
Profile Information
-
Gender
Not Telling
mentalist's Achievements

Member (2/5)
1
Reputation
-
Hi, I'm sort of up-skilling this week and am playing with Zend... I'm after the quickest n simplest way to get going, for now... (ideally install local to project, so can test over time with diff versions etc...?) To start with I followed the full instructions here: https://framework.zend.com/downloads Which were basically: composer require zendframework/zendframework I executed that within a directory within (say) public_html (no virtual hosts here! /var/www/html/demo/) Is that right, or am I supposed to install that in a non public directory? Where usual (CentOS 7)? Is the next step to create a project, like this: https://framework.zend.com/downloads/skeleton-app composer create-project -n -sdev zendframework/skeleton-application path/to/install i.e. is this in the same directory as before, or in its own public directory, etc? All tips welcome Thanks
-
But because there are two forms on the page, I feel have to use the # id identifier too? My problem seems to be that both forms use the first forms' current values, whereas the second form should use its own values.
-
This should be really simple... basically its a class which generates a search / filter form for a list. If I just use it once this works fine, but when I try to do two implementations the second form uses the information from the first form. See in the "this.view_recalc" function in the "GET SELECT OPTION" part: <!doctype html> <head> <script src="jquery-1.11.2.min.js"></script> <style> td{vertical-align:top;} .myform{border:1px solid black;} .mylist{border:1px solid red;} .mylist .nub_items_title,.mylist .nub_items{} .mylist .nub_items_title:after,.mylist .nub_items:after{content:'';display:block;clear:both;} .mylist span[itemprop="title"]{width:100px;float:left;font-weight:bold;} .mylist span[itemprop="name"]{width:100px;float:left;} .mylist span[itemprop="type"]{width:100px;float:left;} .mylist span[itemprop="logo"]{width:100px;float:left;} } </style> <script> var listfilter = function (id_form,id_list,v) { var self = this; this.idname = id_form; this.idlist = id_list; //this.vals = v; var vals = v; this.init = function(){ console.log('Initialising list: '+this.idname); this.add_form(); } this.add_form = function(){ //console.log('Initialising list: '+this.idname); // CREATE FORM var data = "<form class='nub_list_form'>"; for(i=0;i<vals.length;i++){ data += "<select class='target_nublist' name='"+vals[i][0]+"' />"; } data += "</form>"; // ADD FORM $("#"+this.idname+"").each(function(i){ $(this).html("hello: "+data); }); // GET FORM HANDLE var obj_form = $("#"+this.idname+" form")[0]; // LOOP ITEMS for(i=0;i<vals.length;i++){ // GET & FILL SELECT var o = $(obj_form).children("select[name='"+vals[i][0]+"']");//[0]; // [0]; for (j = 0; j < v[i][2].length; j++){ $(o).append($('<option/>', { value: vals[i][2][j][0], text : vals[i][2][j][1] })); } // SET DEFAULT / SELECTED $(obj_form).children("select[name='"+vals[i][0]+"']").val(vals[i][1]); } // ADD CHANGE HANDLERS $(obj_form).children("select").change(function(){ // REDRAW self.view_recalc(); }); } this.view_recalc = function(){ var vt = vals; //alert("#"+self.idlist+" .nub_items"); // LOOP ITEMS $("#"+self.idlist+" .nub_items").each(function(i){ var o=this; var flag = 0; for(i=0;i<vt.length;i++){ // GET SELECT OPTION //var v = $("#"+this.idlist+" select[name='"+this.vals[i][0]+"']").val(); //var v = $("#"+self.idlist+" select[name='"+vt[i][0]+"']").val(); //var v = $("#"+self.idlist+" select[name='"+vt[i][0]+"']").val(); //var v = $(o+" select[name='"+vt[i][0]+"']").val(); var v = $("select[name='"+vt[i][0]+"']").val(); /*var v = "Any"; $(this).find("select[name='"+vt[i][0]+"']").each(function(ii){ v=$(o).val(); });*/ /*var v = "Any"; $(this).children("select[name='"+vt[i][0]+"']").each(function(ii){ v=$(this).val(); });*/ if(v!="Any"){ // SEARCH $(this).find('span').each(function(ii){ if($(this).attr('itemprop')==vt[i][0]){ if($(this).text()==v){ flag+=1; //return false; // break; } } }); }else{ // PASS flag+=1; } } // DECIDE if(flag==vt.length){ $(this).css("display","block"); }else{ $(this).css("display","none"); } }); } }; $(function() { var listfilter1 = new listfilter('myform1','mylist1', [ ["type","Female",[["Any","All"],["Male","Men"],["Female","Woman"]]], ["name","Bob",[["Any","All"],["Alice","Alice"],["Bob","Bob"]]], ["logo","Logo B",[["Any","All"],["Logo A","Logo aa"],["Logo B","Logo bb"],["Logo C","Logo cc"]]] ]); var listfilter2 = new listfilter('myform2','mylist2', [ ["type","Female",[["Any","All"],["Male","Men"],["Female","Woman"]]], ["name","Bob",[["Any","All"],["Alice","Alice"],["Bob","Bob"]]], ["logo","Any",[["Any","All"],["Logo A","Logo aa"],["Logo B","Logo bb"],["Logo C","Logo cc"]]] ]); listfilter1.init(); listfilter2.init(); }); </script> </head> <body> <table><tr><td style='width:240px;'> <div id='myform1' class='myform'> </div> <div id='myform2' class='myform'> </div> </td> <td style=''> <div id='mylist1' class='mylist'> <div class='nub_items_title'> <span itemprop='title'>Title</span> <span itemprop='name'>Name</span> <span itemprop='type'>Type</span> <span itemprop='logo'>Logo</span> </div> <div class='nub_items'> <span itemprop='title'>Miss</span> <span itemprop='name'>Alice</span> <span itemprop='type'>Female</span> <span itemprop='logo'>Logo A</span> </div> <div class='nub_items'> <span itemprop='title'>Mr</span> <span itemprop='name'>Bob</span> <span itemprop='type'>Male</span> <span itemprop='logo'>Logo B</span> </div> <div class='nub_items'> <span itemprop='title'>Mz</span> <span itemprop='name'>Eve</span> <span itemprop='type'>Female</span> <span itemprop='logo'>Logo C</span> </div> </div> <div id='mylist2' class='mylist'> <div class='nub_items_title'> <span itemprop='title'>Title</span> <span itemprop='name'>Name</span> <span itemprop='type'>Type</span> <span itemprop='logo'>Logo</span> </div> <div class='nub_items'> <span itemprop='title'>Miss</span> <span itemprop='name'>Alice</span> <span itemprop='type'>Female</span> <span itemprop='logo'>Logo A</span> </div> <div class='nub_items'> <span itemprop='title'>Mr</span> <span itemprop='name'>Bob</span> <span itemprop='type'>Male</span> <span itemprop='logo'>Logo B</span> </div> <div class='nub_items'> <span itemprop='title'>Mz</span> <span itemprop='name'>Eve</span> <span itemprop='type'>Female</span> <span itemprop='logo'>Logo C</span> </div> </div> </td> </tr> </table> <div style='clear:both;'></div> <br /><br /> <a href='index.html'>INDEX</a> <br /><br /> </div> </body> </html> Thanks
-
Does anybody know why this code is adding itself (i.e. an empty zip file of same name, full path) to the zip file? $fn="data/test_01.zip"; $zip = new ZipArchive(); if($zip->open($fn,ZipArchive::OVERWRITE)!==TRUE){ echo "cannot open ".$fn; } $zip->addFromString("myfile.txt","Some content"); $zip->addEmptyDir("testdir"); $zip->close(); I've fully updated my system and restarted services
-
That was my sentiment last night, not enough code to replicate the issue...
-
I have this accordion code from somewhere, however when you come from the right hand-side all the elements shrink even though you're over the purple / last one... How to fix please? The CSS: <style> .accordionH { margin: 30px auto; padding: 0; list-style-type: none; overflow: hidden; width: 800px; height: 200px; } .accordionH li { margin: 0; padding: 0; overflow: hidden; -webkit-backface-visibility: hidden; backface-visibility: hidden; -webkit-transition: all 0.2s ease-in; -moz-transition: all 0.2s ease-in; transition: all 0.2s ease-in; } .accordionH li { width: 160px; height: 200px; float: left; } .accordionH:hover li { width: 50px; } .accordionH li:hover { width: 600px; } </style> The HTML: <ul class="accordionH"> <li style="background-color:#f00;"> <p>Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua.</p> </li> <li style="background-color:#0f0;"> <p>Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua.</p> </li> <li style="background-color:#00f;"> <p>Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua.</p> </li> <li style="background-color:#0ff;"> <p>Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua.</p> </li> <li style="background-color:#f0f;"> <p>Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua.</p> </li> </ul> Also, the purple one flickers at times, especially when bringing the mouse in from the top or bottom? Supposedly "backface-visibility" is supposed to fix it, or suggested was to use 3D transition instead, but prefer not...!? Cheers
-
Burgers got in the way yum yum function do_incode($s){ $a=array("blog"); foreach($a as $e){ $re="/\[".$e."(.+?)\]/"; if(preg_match_all($re, $s, $matches, PREG_OFFSET_CAPTURE | PREG_SPLIT_NO_EMPTY)){ $n=0; foreach($matches[0] as $ee){ //$va=str_getcsv(trim($matches[1][$n][0])," "); $re='/"(.*?)"|(=)|\'(.*?)\'| +/'; $va=preg_split($re, trim($matches[0][$n][0],"[]"), -1, PREG_SPLIT_DELIM_CAPTURE | PREG_SPLIT_NO_EMPTY); $replace=blog_incode($va); $re="/".preg_quote($ee[0])."/"; $s=preg_replace($re,$replace,$s,1); // USE 1 TO LIMIT TO FIRST MATCH, FOR DUPLICATES...??? $n++; } } } return $s; } Good enough for now... Cheers for pointing out my daftness lol
-
In reality it can of arbitrary length and either quoted or not, or even nothing at all. It does work as required when " are used, its just the ' case which doesn't...... Oops forgot that was the reason it was extracting the strings... no wonder the regex wasn't acting as expected I'll be back ... thankyou
-
Hi, this works with double quotes but fails on single quotes... I've been stuck on the wrong issue for a while so my heads boxed now lol Any help much appreciated. //$s='Test string [blog "xx yy" zz] one two three'; $s="Test string [blog 'xx yy' zz] one two three"; echo do_incode($s); function do_incode($s){ $a=array("blog"); foreach($a as $e){ $re="/\[".$e."(.+?)\]/"; //$re='/\['.$e.'"(?:\\\\.|[^\\\\"])*"|\S+\]/'; //$re='/\['.$e.' (`"([^"]*)"`)\]/'; if(preg_match_all($re, $s, $matches, PREG_OFFSET_CAPTURE)){ //$func=$this->api_register_get($e,'incode'); $n=0; foreach($matches[0] as $ee){ $va=str_getcsv(trim($matches[1][$n][0])," "); //$replace=$func($va); $replace=blog_incode($va); $re="/".preg_quote($ee[0])."/"; $s=preg_replace($re,$replace,$s,1); // USE 1 TO LIMIT TO FIRST MATCH, FOR DUPLICATES...??? $n++; } } } return $s; } function blog_incode($v){ //$s="<b>*** INCODE [ :".$v[0].": ".(isset($v[1])?$v[1]:"")." ] WORKED ***</b>"; $s="<b>*** INCODE [ :".$v[0].": ] WORKED ***</b>"; return $s; }