Giter VIP home page Giter VIP logo

Comments (13)

ozee31 avatar ozee31 commented on May 15, 2024 1

Or use concatenation :

{'action': 'delete/' ~ user.id}

from legacy-twig-view.

WyriHaximus avatar WyriHaximus commented on May 15, 2024

Change your template file extension to .tpl instead of .ctp. Also you can't mix cake's template syntaxt and twig's

from legacy-twig-view.

y4nn0ff avatar y4nn0ff commented on May 15, 2024

Thanks, it works.

But what is the twig syntax for this :

$this->Html->css('base.css')
$this->Flash->render()
$this->fetch('css')
$this->fetch('content')

And what is the best practice to use angular and twig without conflict (because curly bracket) with you module ?

Regards ;)

from legacy-twig-view.

WyriHaximus avatar WyriHaximus commented on May 15, 2024

The first question is easy:

{{ html.css('base.css') }}
{{ flash.render() }}
{{ _view.fetch('css') }}
{{ _view.fetch('content') }}

Give me a couple of days to come back with you on the second question as it will require a new feature #15

from legacy-twig-view.

y4nn0ff avatar y4nn0ff commented on May 15, 2024

Good, thanks ;)

is there a documention anywhere for this ? (html,flash,_view) to avoid these questions ;)

Good luck to develop the #15

from legacy-twig-view.

WyriHaximus avatar WyriHaximus commented on May 15, 2024

Yes there is: https://github.com/WyriHaximus/TwigView#helpers

from legacy-twig-view.

y4nn0ff avatar y4nn0ff commented on May 15, 2024

there are something weird :s

{{ html.* }}, {{ flash.* }}, en {{ _view.fetch('css') }} write nothing in the DOM when it's rendered in a browser. And {{ _view.fetch('content') }} display the html code in browser.

<h1>Connexion</h1>
<form method="post" accept-charset="utf-8" action="/users/login"><div style="display:none;"><input type="hidden" name="_method" value="POST"/></div><input type="text" name="email"/><div class="input password"><label for="password">Password</label><input type="password" name="password" id="password"/></div><button type="submit">Login</button></form>

I must miss something...

from legacy-twig-view.

WyriHaximus avatar WyriHaximus commented on May 15, 2024

Take a look at dump (the twig site in general is very useful). (Using x.* also won't do anything, at least not what you want.) Also all output is encoded by default for security reasons. Both raw and autoescape can help you with this. Also this is where the config feature I'm working on comes in handy: http://twig.sensiolabs.org/doc/api.html#environment-options

from legacy-twig-view.

visonforcoding avatar visonforcoding commented on May 15, 2024

Could I use Twig layout syntax , for example , extend include block . And how can i config the twig compile dir . can you give more information about it .Thanks ,wait for your reply

from legacy-twig-view.

WyriHaximus avatar WyriHaximus commented on May 15, 2024

Tackled this in: https://github.com/WyriHaximus/TwigView/releases/tag/3.2.0

from legacy-twig-view.

tolawho avatar tolawho commented on May 15, 2024

@WyriHaximus I generate a link like: /users/delete/id but it not working
Example:
In ctp template:
<?= $this->Form->postLink(__('Delete'), ['action' => 'delete', $user->id], ['confirm' => __('Are you sure you want to delete # {0}?', $user->id)]) ?>

In twig template:
{{ Form.postLink(__('Delete'),{'action' : 'delete', user.id },{'confirm' : __('Are you sure you want to delete # {0}?', user.id),'class':'button03'})|raw }}
Error found at {'action' : 'delete', user.id }
image
If i use a colon like: {'action' : 'delete', 'id': user.id } => my result is /users/delete?id=2 (Rigth result is /users/delete/2)

Please help!

from legacy-twig-view.

WyriHaximus avatar WyriHaximus commented on May 15, 2024

Try:

{'action' : 'delete', 0: user.id }

from legacy-twig-view.

WyriHaximus avatar WyriHaximus commented on May 15, 2024

@ozee31 thank you, I wasn't aware of that. I've created a new PR (#22) to add that to the documentation 👍 . Merging it tonight unless someone has feedback

from legacy-twig-view.

Related Issues (20)

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.