Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Twig Template Loading Error - v2.0 #54

Closed
jalendport opened this issue Aug 4, 2018 · 13 comments
Closed

Twig Template Loading Error - v2.0 #54

jalendport opened this issue Aug 4, 2018 · 13 comments

Comments

@jalendport
Copy link

Using the latest version of Craft 3 and Craft Cheat Sheet.

Just downloaded it and attempting to visit mysite.test/cheatsheet results in the following error:

Twig Template Loading Error – craft\web\twig\TemplateLoaderException
Unable to find the template “_includes/fieldMacros.twig” in "cheatsheet" at line 2.

It's quite possible it's some misconfiguration or weird setup on my site so please don't hesitate to ask for log files or whatever to make debugging easier...

@erikreagan
Copy link
Member

erikreagan commented Aug 4, 2018 via email

@jalendport
Copy link
Author

Hey! Via the plugin store.

@erikreagan
Copy link
Member

@jalendport @pogorzels Can one (or both) of you share your composer.json and composer.lock files from the root of your project? I'd like to explore the overlaps and see if there may be a conflict with another plugin at play.

Feel free to share them here or email them to dev@focuslabllc.com.

@erikreagan
Copy link
Member

@jalendport I just published 2.0.2 which I believe will resolve this. Let me know if that's not the case though. Thanks!

@dowadidi
Copy link

dowadidi commented Aug 6, 2018

I have v2.0.2 installed, and I get a similar error, but on lines 139-145. The plugin could not load _includes/fieldMacros.twig in /craft/vendor/focuslabllc/craft-cheat-sheet/src/templates/frontEnd/cheatsheet.html.

@erikreagan
Copy link
Member

@DiederikVanHoorebeke We had an error in the version tagging that may have cause the update to not work correctly. Can you try updating the plugin via composer and see if that fixes the problem?

@dowadidi
Copy link

dowadidi commented Aug 6, 2018

@erikreagan I tried, but I get: The requested package focuslabllc/craft-cheat-sheet could not be found in any version, there may be a typo in the package name.

I uninstalled the plugin, cleared the composer cache and installed it using the plugins store, but still got the same error as before.

So, I downloaded the repository, and replaced the files. To no avail...

@erikreagan
Copy link
Member

@DiederikVanHoorebeke Apologies. I forgot we hadn't published to Packagist yet. You should be able to use composer now and not receive that message.

@dowadidi
Copy link

dowadidi commented Aug 7, 2018

@erikreagan I'm afraid it didn't help...

I uninstalled the plugin in the CP and did the following:

$ composer clearcache
Cache directory does not exist (cache-vcs-dir):
Clearing cache (cache-repo-dir): ~/.composer/cache/repo
Clearing cache (cache-files-dir): ~/.composer/cache/files
Clearing cache (cache-dir): ~/.composer/cache
All caches cleared.
$ composer require focuslabllc/craft-cheat-sheet
Using version ^2.0 for focuslabllc/craft-cheat-sheet
./composer.json has been updated
Loading composer repositories with package information
Updating dependencies (including require-dev)
Package operations: 1 install, 0 updates, 0 removals
  - Installing focuslabllc/craft-cheat-sheet (2.0.2): Downloading (100%)
Writing lock file
Generating optimized autoload files

Then I installed and configured the plugin to get:
image

@MattWilcox
Copy link

I'm getting this error also, on a fresh install of Craft3 and a fresh install of this plugin. I don't use Composer at all; the Craft3 install was from the zip, if that makes any difference. The plugin install was through the admin panel and plugin store.

@erikreagan erikreagan reopened this Aug 12, 2018
@erikreagan
Copy link
Member

Thanks guys. Reopening as we investigate further.

@khalwat
Copy link

khalwat commented Aug 13, 2018

You can fix this by changing it to a full path here:

                     {{ view.renderTemplateMacro('cheat-sheet/frontEnd/_includes/fieldMacros.twig', csMacros[fieldClass], [
                            {
                                'sampleTag' : sampleTag ~ '.' ~ field.handle,
                                'field'     : field,
                                'whitespace': whitespace
                            }
                        ])|raw }}

Once a template starts rendering, there’s no guarantee that something else won’t be rendering something, so you can’t count on just changing the template path.

@erikreagan
Copy link
Member

Update: this error was encountered when a few other plugins were present in a Craft install. @khalwat came in clutch (above) with a simple fix. The patch has been released with a fix to this in 2.0.3.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

5 participants