Giter VIP home page Giter VIP logo

Comments (11)

rcrowe avatar rcrowe commented on August 16, 2024

$response->getOriginalContent() returns a string not a view object within the event.

The reason Turbo does this is that is has to render the view in order to extract the <body> and <title>, so by the time the event has fired the view has already been rendered.

I'm not sure why you are creating an instance of Turbo and trying to pass in a parameter. Looks like maybe your using an older version of the Library, 0.2.0 is the latest version.

Event::listen('turbo.pjax', function($request, $response) {
    var_dump( $response->getOriginalContent() );
});

This will give you the HTML that is to be returned to the client as a string.

from turbo.

goosechaser avatar goosechaser commented on August 16, 2024

I was using "rcrowe/turbo": "0.1.*" as per your installation instructions. Perhaps you should change them :) Thanks.

from turbo.

goosechaser avatar goosechaser commented on August 16, 2024

Still getting an error but this time ONLY when a pjax request is sent (e.g., http://site.com/test?_pjax=%23ajax).

Screenshot: http://i.imgur.com/5mtV7Rh.png

from turbo.

rcrowe avatar rcrowe commented on August 16, 2024

Are you doing anything special with your views? Using any other packages that affect this?

I just haven't seen this before, so will have to help me debug it. If you output get_class($response) what class is it?

Is it possible to put make your codebase / example available.

from turbo.

goosechaser avatar goosechaser commented on August 16, 2024
  • My template is an empty file with "test" string inside it.
  • I am returning View::make('template').
  • Response class is string(24) "Illuminate\Http\Response".
  • PJAX works fine without TURBO. I have not issues with anything else.
  • My routes.php as Event::listen as per your usage/installation instructions.

from turbo.

rcrowe avatar rcrowe commented on August 16, 2024

Is the error taking place in the Event?

I have the same thing setup working fine, so not sure what's happening here.

I'll put an example of Turbo up later see if it helps you.

On 22 May 2013, at 14:52, goosechaser [email protected] wrote:

My template is an empty file with "test" string inside it.
I am returning View::make('template').
Response class is string(24) "Illuminate\Http\Response".
PJAX works fine without TURBO. I have not issues with anything else.
My routes.php as Event::listen as per your usage/installation instructions.

Reply to this email directly or view it on GitHub.

from turbo.

goosechaser avatar goosechaser commented on August 16, 2024

Nope, it's not the event that's causing it. It works if you remove the ->render() method.

from turbo.

rcrowe avatar rcrowe commented on August 16, 2024

I'll put an example together and see whether it works fine for you. Can't repeat the issue you are seeing.

On 22 May 2013, at 15:37, goosechaser [email protected] wrote:

Nope, it's not the event that's causing it. It works if you remove the ->render() method.


Reply to this email directly or view it on GitHub.

from turbo.

goosechaser avatar goosechaser commented on August 16, 2024

Try using your code with:

$template = View::make("template");
return $template;

from turbo.

rcrowe avatar rcrowe commented on August 16, 2024

Are you still seeing this issue? still not able to recreate it here.

from turbo.

rcrowe avatar rcrowe commented on August 16, 2024

Can you try changing your composer dependency to the following and see if it fixes your issue.

"rcrowe/turbo": "dev-render"

from turbo.

Related Issues (3)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.