Jeisson Posted October 27, 2015 Share Posted October 27, 2015 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? Quote Link to comment Share on other sites More sharing options...
benanamen Posted October 27, 2015 Share Posted October 27, 2015 How about posting your code. Quote Link to comment Share on other sites More sharing options...
Jeisson Posted October 27, 2015 Author Share Posted October 27, 2015 (edited) 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 Edited October 27, 2015 by Jeisson Quote Link to comment Share on other sites More sharing options...
Jeisson Posted October 28, 2015 Author Share Posted October 28, 2015 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 Quote Link to comment Share on other sites More sharing options...
jamesmpollard Posted October 29, 2015 Share Posted October 29, 2015 Glad to hear you've solved it and it's brilliant that you've posted how you did too for others to learn from but when you post code, please use the code tags to make it more pleasant on the eye. Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.