Jump to content

Recommended Posts

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?

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 by Jeisson

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

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • 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.