Jump to content


  • Posts

  • Joined

  • Last visited

Jeisson's Achievements


Member (2/5)



  1. I know what the customer wants it to do. And the serverside data is now in a text file .dat I put the same data in a .json file and fetch the data from there and handle it with javascript. I don't see a problem there. However I found out this code actually works on the current customer server. But not on my test server(s). Thanks for all comments.
  2. ok thanks i think I'll suggest a complete rewrite. I am not good at php, so I would do this in javascript. but thanks for your analyzis and advice. I appreciate
  3. Thank you for your answers. the script is supposed to add correct filenames from .dat files so that in the html there would be correct images. these are chosen with drop boxes. also populate the dropboxes. this script i got from customer. it used to work a few years ago. hope this part help function rowColour($row) {return ($row % 2 == 0 ? "listrow01" : "listrow02");} function readObjectsFromFile($file_name){ $file_rows = file($file_name); $object_list = array(); for($i=0;$i<count($file_rows);$i++){ $object = __unserialize($file_rows[$i]); $object_list[count($object_list)] = $object; } return $object_list; } function getFramesFromFile(){ $frames_list = readObjectsFromFile("styles/frames/frames.dat"); return $frames_list; } function getMirrorsFromFile(){ $mirrors_list = readObjectsFromFile("styles/mirrors/mirrors.dat"); return $mirrors_list; } function getPricesFromFile(){ $prices_list = readObjectsFromFile("prices.dat"); return $prices_list; } function getDefaultDoorFromFile($index){ $door_list = readObjectsFromFile("styles/defaultdoor.dat"); $door = $door_list[$index]; return $door; } function getDefaultFrame($index){ $door = getDefaultDoorFromFile($index); return $door->frame; } function __serialize($object) { $serialized = serialize($object); return htmlentities($serialized,ENT_QUOTES); }
  4. I have problems with a script. The error log says I should change the preg_replace to preg_replace_callback I dont know how to do it, so please help. function __unserialize($string) { $unserialized = stripslashes($string); $unserialized = preg_replace('!s:(\d+):"(.*?)";!e', "'s:'.strlen('$2').':\"$2\";'", $unserialized ); return unserialize($unserialized); } Edit: I did try to do it. so if you want to see what I tried I ofcourse can show. But it reutned a blank screen
  5. I have an iframe in a html or php site (tried both) and it works fine on Firefox and my mobile browsers. But Chrome behaves badly. The iframed php page contains a form and when I send it the whole iframe disapears. But it reapears when "painting it with my mouse". no cliks needed. just some mouseover/hovering. The whole iframe don't appear at once but small part of it. Therefor the "painting expirience". It is annoying because the visitor don't kmow to do this. Sorry, but i dont know how to explain this any better. the form is a domain lookup form (whois).
  6. I have a php file in a iframe from where I take a form result to the parent with following jquery code. In the example there is both appendTo to a <p> and an input element. Anyway works fine on desktop browsers as far as I have tested, but not on my phone . <script> $('#order').click(function() { var free = $('#iframeid').contents().find('#free').text(); $("<span>"+free+" </span>").appendTo("#g"); $('.g').val($('.g').val() + vapaa); }); </script> <button id="order">'order domain</button> <p> <div id="wrap"> <p id="g"></p><p> <input type="text" class="g" id="inputbox" name="input" placeholder="www.example.com" width="100px"/> </div> Any other solutions? I managed only to make these. Preferable I use input text element. The span was just for a test. Thanks.
  7. Ok now I realize. I thought in my case they would be valid but that is not the case. Need to re-think the whole thing now. Something like decoding each file and then getting what I am lookin for and store that as new json. Whole merging and concatening I think I do not need..
  8. yeah I will see. My json files are not ready yet. So I will work on them when I have the code that does something with them. Iḿ just such a noob. May I ask why first code works json_decode($complete_json,true); var_dump($complete_json); while this not. $content = json_decode($complete_json,true); var_dump($content); I just don see the logic always
  9. I don't yet have any better approach I'm just thinking out loud. I will need to try and test. this was first step. Are you suggesting it would be safe way to decode everything then array_merge and encode this to json?
  10. thank you I will continue from here. The json files have all same structure so I thought I could merge them to one. But if that will not work I will try to get a specific key from each files directly. Maybe something like that would be better anyway.
  11. Hello I have several json files in one directory. i would like to merge them in to one. I did something like this <?php foreach (glob("../json/*.json") as $filename) { echo basename($filename) . "\n"; } $res1 = file_get_contents($filename); echo $res1; ?> But it echoes only the last (the first echo is to view all files which is not important here) Then I tried many versions of foreach inside foreach with no success. Like this: <?php foreach (glob("../json/*.json") as $filename) { foreach (file_get_contents($filename) as $a) { } } echo $a; ?> So I appreciate a little help here, thank you.
  12. started a new topic on xml -> SELECT (option) with jquery n example
  13. Hello I would like to populate the select onload. or document ready with jquery I dont see why not working' <!DOCTYPE html> <html> <head> <meta charset="utf-8"> <title>xml to select</title> <script src="https://ajax.googleapis.com/ajax/libs/jquery/1.4.4/jquery.min.js"></script> <script> $(document).ready(function() { $.ajax({ type: "GET", url: "test.xml", dataType: "xml", success: function(xml) { $("#myDiv").append("<select id='mySelect'>"); $(xml).find('value').each(function(){ var a = $(this).text(); $("#mySelect").append("<option class='nice' value='" + a + "'>" + a + "</option>"); }); $("#myDiv").append("</select>"); } }); }</script> </head> <body> <div id="myDiv"></div> </body> </html> Thank you for your advice.
  14. ok. maybe I should directly do it that way then. i just thought i could "manually" do like I was asking first. I know how to get json to array. havent done before select populsting or what should i call it..
  15. I get that. But wont work in my case. I need the value to be dynamical. I will get it from a json or similar. So Now I thought to get it from an Array. Afterwards I parse the json to that specific array.
  • 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.