Giter Site home page Giter Site logo

Comments (4)

kenjis avatar kenjis commented on May 20, 2024

You don't have to add base_url, because this library does it.
See https://github.com/kenjis/codeigniter-ss-twig#supported-codeigniter-helpers.

from codeigniter-ss-twig.

waptik avatar waptik commented on May 20, 2024

Okay thanks, I got it working.

Also I have this issue . I added the widget() method your library as follow:

// libraries / Twig.php
.....
public function widget($name){
$this->_widget = '_includes.'$name.'.html';
return $this;
}

// in my controller/home.php
.....
public function index(){
$this->twig->addGlobal->('twig', $this->twig);
......
$this->twig->display('home');
}

// views home.php
{# let's include the header page #}

{% include twig.widget.header %}

{# end #}

............#

This is the error I get
A PHP Error was encountered
Severity: Warning
Message: Missing argument 1 for Twig::widget(), called in .......

from codeigniter-ss-twig.

kenjis avatar kenjis commented on May 20, 2024

Do you want like this?

public function widget($name){
  return $this->_widget = '_includes.'$name.'.html';
}
{% include twig.widget(header) %}

from codeigniter-ss-twig.

waptik avatar waptik commented on May 20, 2024

Yes that's what I was working on. Do you know any idea how to achieve it?
UPDATE 1 : I tried your solution but I got this error :
An Error Was Encountered

Unable to find template "_includes/0.html" (looked into: /home/waptik/public_html/../..app/views/twig).

I don't know why it's 0.html and not header.html

UPDATE 2: I got it working with this {% include twig.widget('header') %}
Thanks for the hand.

from codeigniter-ss-twig.

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.