Jump to content

Jeisson

Members
  • Posts

    40
  • Joined

  • Last visited

Everything posted by Jeisson

  1. 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).
  2. 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.
  3. 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..
  4. 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
  5. 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?
  6. 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.
  7. 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.
  8. started a new topic on xml -> SELECT (option) with jquery n example
  9. 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.
  10. 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..
  11. 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.
  12. Hello there friends I have an select box and I would like to define the alue of the selects with array. Like this: var price_list= new Array(); price_list["-"]=0; price_list["bronze"]=5; price_list["silver"]=10; price_list["gold"]=15; The I have a Selectbox where <form action="" id="metal" onsubmit="return false;" <select id="a" name="metals" class="form-select"> <option value="-">-</option> <option value="bronze">bronze</option> <option value="silver">silver</option> <option value="gold">gold</option> </select> And performig calculations with following script (that works fine if the value is directly in select). And obviously there is another select (#b) but that is just numbers so I didn show it here. $(document).ready(function() { function compute() { var a = $('#metals').val(); var b = $('#b').val(); var total = a * b * 1.22; $('#result').text(total); } $('#metals, #b').change(compute); }); I just get returned NaN If you have an answer then please hit
  13. I solved it by changing echo to print_r and skipping the ajax for now and wrote php file_get_contents snippet instead I suspect there is something in the ('up') and ('down') that needs to be printed properly. I use (\'up\') and works fine wit php but not ajax
  14. Yes sorry I should have had that. I try to show essential code. //first some html like this <div id="scrollable-v1" class="scrollable"> <div class="belt"> <?php //then here are some api stuff //echoing and parsing and echoing like below shortened foreach ( $es as $it){ echo '<li>'; echo '[<all kind>]; foreach ( $ve as $ti){ echo 'a lot if text and stuff like that'; } } ?> </div> </div> <div class="skroll"> <img src="up.png" onMousedown="scrollv1.scrollContent('up')" onMouseup="scrollv1.stopScroll()" class="up"> <img src="dwn.png" onMousedown="scrollv1.scrollContent('down')" onMouseup="scrollv1.stopScroll()" class="dwn"> </div> code up works if I run in browser copypaste the output and save as a txt file. So I tried to do this saving with php. Like this here down //auto txt file code <?php // here are some api stuff //echoing and parsing and echoing like below shortened echo ' <div id="scrollable-v1" class="scrollable"> <div class="belt">'; ob_start(); //this is different from upper foreach ( $es as $it){ echo '<li>'; echo '[<all kind>]; foreach ( $ve as $ti){ echo 'a lot if text and tuff like that'; } } echo ' </div> </div> <div class="skrollit"> <img src="up.png" onMousedown="scrollv1.scrollContent(\'up\')" onMouseup="scrollv1.stopScroll()" class="up"> <img src="dwn.png" onMousedown="scrollv1.scrollContent(\'down\')" onMouseup="scrollv1.stopScroll()" class="dwn"> </div>'; $content = ob_get_contents(); file_put_contents('output.txt', "\xEF\xBB\xBF". $content); ?> Sorry if my shortening made it a mess. anyway diff services find no difference. nor do I. Started to think maybe it saves in other format? The txt file is used in jquery ajax load wordpress
  15. Hi When I have a file that echoes some stuff and I press view source and copy paste the source and manually makes this to a .txt file Something different happening somewhere comapred to if I have ob_start() //before the content ob_get_contents and file_put_contents //after to make the text file. I' do get a text file. It looks the same. the content is the same as my manually made. But when I load it with ajax in to my div only the manually made is scrollable. the scroll is made with .js What is going on here?
  16. Resolved. I didn´t find trough googeling nyesterday but today I found easily an alternative. I use before the desired content ob_start(); and after $content = ob_get_contents(); file_put_contents('output.txt',$content);
  17. I was hasting. Did not notice thius does not give desired result. this system gives all info, but it makes two different list. first all of $s1 then all of $s2 what I wanted is like the echo did. ie. $s1 Venue1 $s2 Date1 - Ti1 $s1 Venue2 $s2 Date2 - Ti2 $s1 Venue3 $s2 Date3 - Ti3 and so on
  18. Tried it. worked partially. but full solution was simply to do the same "trick" fo $s1 and that was it.
  19. wau beautiful. so many details in this language. I have not yet tried it but sounded convincing. Thank you.
  20. Hello I have problem to get the whole loop saved in to a file. I seams to save only the last "section" So I have two json files that I decode and managed to echo as I wanted. Now plans changed and I want to save what was echoed in to a file instead. I planned to use file_put_contents for that. My code looks like this but it did not put the whole list in to the file. just one. (I show you only the foreach and attempted file saving. <code> foreach ( $venues as $item){ $s1 = '<li style="padding-top:15px;">' . '<a target="_blank" href="http://foursquare.com/v/' . $item['id'] . '">' . $item['name'] . '</a></li>'; $endpoint2 = 'venues/' . $item['id'] . '/tips'; $params2 = '?limit=1'; $url2 = $base_url.$endpoint2.$params2.$auth; $results2 = file_get_contents($url2); $json_results2 = json_decode($results2,true); $venues2 = $json_results2['response']['tips']['items']; foreach ( $venues2 as $ti){ $s2 = '<li>' . '<span>' . date('j.n.Y',$ti['createdAt']) . '</span>' . ' - ' . $ti['text'] . '</li>'; } } file_put_contents('output.txt',$s1 . $s2); //echo $s1 . $s2; //for quick check </code> If I remove the $s1 and respectively $s2 and put the echo instead I get the whole result on my screen. So why is this only taking the last <li><a href="url and result and so on in to the file? This forum did not allow me to format my text, so appologises for that.
  21. Sorry guys. I have too many tabs open. Here is correct json. It is truncated because it is very long. {"meta":{"code":200,"requestId":"561d68a0498ed5ffa3210d59"},"response":{"suggestedFilters":{"header":"Tap to show:","filters":[{"name":"Open now","key":"openNow"},{"name":"With specials","key":"specials"}]},"geocode":{"what":"","where":"london","center":{"lat":51.50853,"lng":-0.12574},"displayString":"London, Greater London, United Kingdom","cc":"GB","geometry":{"bounds":{"ne":{"lat":51.691643999655895,"lng":0.33418999705203406},"sw":{"lat":51.28467404417054,"lng":-0.5085579279369435}}},"slug":"london","longId":"72057594040571679"},"headerLocation":"London","headerFullLocation":"London","headerLocationGranularity":"city","query":"food","totalResults":246,"suggestedBounds":{"ne":{"lat":51.51263103703768,"lng":-0.12231439480184818},"sw":{"lat":51.50654795865553,"lng":-0.1314193179278593}},"groups":[{"type":"Recommended Places","name":"recommended","items":[{"reasons":{"count":0,"items":[{"summary":"This spot is popular","type":"general","reasonName":"globalInteractionReason"}]},"venue":{"id":"4ac518c4f964a5209aa420e3","name":"Wahaca","contact":{"phone":"+442072401883","formattedPhone":"+44 20 7240 1883","twitter":"wahaca"},"location":{"address":"66 Chandos Pl","lat":51.51022652594927,"lng":-0.12449473142623901,"postalCode":"WC2N 4HG","cc":"GB","neighborhood":"Covent","city":"London","state":"Greater London","country":"United Kingdom","formattedAddress":["66 Chandos Pl","London","Greater London","WC2N 4HG","United Kingdom"]},"categories":[{"id":"4bf58dd8d48988d1c1941735","name":"Mexican Restaurant","pluralName":"Mexican Restaurants","shortName":"Mexican","icon":{"prefix":"https:\/\/ss3.4sqi.net\/img\/categories_v2\/food\/mexican_","suffix":".png"},"primary":true}],"verified":true,"stats":{"checkinsCount":5406,"usersCount":4132,"tipCount":177},"url":"http:\/\/www.wahaca.co.uk","price":{"tier":2,"message":"Moderate","currency":"£"},"hasMenu":true,"rating":9.1,"ratingColor":"00B551","ratingSignals":534,"menu":{"type":"Menu","label":"Menu","anchor":"View Menu","url":"https:\/\/foursquare.com\/v\/wahaca\/4ac518c4f964a5209aa420e3\/menu","mobileUrl":"https:\/\/foursquare.com\/v\/4ac518c4f964a5209aa420e3\/device_menu"},"allowMenuUrlEdit":true,"hours":{"status":"Open until 11:00 PM","isOpen":true},"specials":{"count":0,"items":[]},"photos":{"count":220,"groups":[]},"hereNow":{"count":0,"summary":"Nobody here","groups":[]}},"tips":[{"id":"51decb2b498ee8a050cbd86b","createdAt":1373555499,"text":"Baharata düşkün Meksika Mutfağını seviyorsanız mutlaka uğrayın lezzetli ve uygun fiyatlı .","type":"user","canonicalUrl":"https:\/\/foursquare.com\/item\/51decb2b498ee8a050cbd86b","photo":{"id":"51decb2d50193b64eed0a5d3","createdAt":1373555501,"source":{"name":"Foursquare Web","url":"https:\/\/foursquare.com"},"prefix":"https:\/\/irs0.4sqi.net\/img\/general\/","suffix":"\/25407761_lcYmk9RXyoRZG0M8_1_DuW0oYSpCJy7CV_Iad-z78qs.jpg","width":1600,"height":1200},"photourl":"https:\/\/irs0.4sqi.net\/img\/general\/original\/25407761_lcYmk9RXyoRZG0M8_1_DuW0oYSpCJy7CV_Iad-z78qs.jpg","likes":{"count":32,"groups":[],"summary":"32 likes"},"logView":true,"todo":{"count":1},"user":{"id":"25407761","firstName":"Tugba","lastName":"Söyler","gender":"female","photo":{"prefix":"https:\/\/irs2.4sqi.net\/img\/user\/","suffix":"\/25407761-LOAJ2FBBDEDFAOPG.jpg"}}}],"referralId":"e-3-4ac518c4f964a5209aa420e3-0"},{"reasons":{"count":0,"items":[{"summary":"This spot is popular","type":"general","reasonName":"globalInteractionReason"}]},"venue":{"id":"53bab96d498e7e355fb53d6c","name":"Barrafina","contact":{"phone":"+442074401456","formattedPhone":"+44 20 7440 1456","twitter":"barrafinaadst","facebook":"705351912878392","facebookUsername":"BarrafinaAdelaideStreet","facebookName":"Barrafina Adelaide Street"},"location":{"address":"10 Adelaide St","crossStreet":"William IV St","lat":51.50945052890648,"lng":-0.1259482415312226,"postalCode":"WC2N 4HZ","cc":"GB","city":"London","state":"Greater London","country":"United Kingdom","formattedAddress":["10 Adelaide St (William IV St)","London","Greater London","WC2N 4HZ","United Kingdom"]},"categories": it is foursquare api with explore as parameter. the first json was with an another parameter. https://developer.foursquare.com/docs/venues/explore shuffle($results) is error because results is not array "Warning: shuffle() expects parameter 1 to be array, string given"
  22. ok now I see. My mistake. it is from an api that gives json. So no sql, sorry.
  23. here is some json if it helps. it continies like this. { "meta": { "code": 200, "requestId": "561d5921498ed5a1feee2f41" }, "response": { "venues": [ { "id": "516094748302afa746c58951", "name": "Five Guys", "contact": { "phone": "+442072402057", "formattedPhone": "+44 20 7240 2057", "twitter": "five_guys", "facebook": "19836964440", "facebookUsername": "fiveguys", "facebookName": "Five Guys" }, "location": { "address": "1-3 Long Acre", "crossStreet": "at Cranbourne St", "lat": 51.51177397755055, "lng": -0.12685775756835938, "postalCode": "WC2E 9LH", "cc": "GB", "city": "Covent Garden", "state": "Greater London", "country": "United Kingdom", "formattedAddress": [ "1-3 Long Acre (at Cranbourne St)", "Covent Garden", "Greater London", "WC2E 9LH", "United Kingdom" ] }, "categories": [ { "id": "4bf58dd8d48988d16c941735", "name": "Burger Joint", "pluralName": "Burger Joints", "shortName": "Burgers", "icon": { "prefix": "https:\/\/ss3.4sqi.net\/img\/categories_v2\/food\/burger_", "suffix": ".png" }, "primary": true } ], "verified": true, "stats": { "checkinsCount": 14621, "usersCount": 9895, "tipCount": 348 }, "url": "http:\/\/www.fiveguys.co.uk", "allowMenuUrlEdit": true, "specials": { "count": 0, "items": [ ] }, "hereNow": { "count": 3, "summary": "3 people are here", "groups": [ { "type": "others", "name": "Other people here", "count": 3, "items": [ ] } ] }, "storeId": "", "referralId": "v-1444763937" }, { "id": "4cf9619bee9cb60c7bc883ad", "name": "Hakkasan", "contact": { "phone": "+442079277000", "formattedPhone": "+44 20 7927 7000", "twitter": "hakkasanmayfair" }, "location": { "address": "17 Bruton St", "lat": 51.5104785955435, "lng": -0.14460325241088867, "postalCode": "W1J 6QB", "cc": "GB", "city": "Mayfair", "state": "Greater London", "country": "United Kingdom", "formattedAddress": [ "17 Bruton St", "Mayfair", "Greater London", "W1J 6QB", "United Kingdom" ] }, "categories": [ { "id": "4bf58dd8d48988d142941735", "name": "Asian Restaurant", "pluralName": "Asian Restaurants", "shortName": "Asian", "icon": { "prefix": "https:\/\/ss3.4sqi.net\/img\/categories_v2\/food\/asian_", "suffix": ".png" }, "primary": true } ], "verified": false, "stats": { "checkinsCount": 7417, "usersCount": 5145, "tipCount": 255 }, "url": "http:\/\/hakkasan.com\/mayfair", "allowMenuUrlEdit": true, "specials": { "count": 0, "items": [ ] }, "hereNow": { "count": 2, "summary": "2 people are here", "groups": [ { "type": "others", "name": "Other people here", "count": 2, "items": [ ] } ] }, "referralId": "v-1444763937" }, { "id": "50509c8be4b0b28cb0bd0785", "name": "Mezzah Lounge", "contact": { "phone": "+442077301234", "formattedPhone": "+44 20 7730 1234", "twitter": "harrods" }, "location": { "address": "87\u2013135 Brompton Rd", "crossStreet": "Fourth Floor, Harrods", "lat": 51.49864750188004, "lng": -0.1628856295752017, "postalCode": "SW1X 7XL", "cc": "GB", "city": "Greater London", "state": "Greater London", "country": "United Kingdom", "formattedAddress": [ "87\u2013135 Brompton Rd (Fourth Floor, Harrods)", "Greater London", "Greater London", "SW1X 7XL", "United Kingdom" ] } } ] } }
  24. How do I do that? shuffle($results) gives error
  25. Hi I try to show lists in random order. I have json that I decode to arrays and loop over it and show the result. Now I have teried to how it in a random order. but no result. tried allready several different ways.. here is something about: $json_results = json_decode($results,true); $groups = $json_results['response']['groups']; echo '<ul>'; shuffle($groups); foreach($groups as $group) It does continue to function, but with no randomizing order. just same as always..please help. Thanks
×
×
  • 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.