Laravel blade debug view name on error - debugging

when there is some error in view, L4 shows a nice trace, but cached filename:
open: /var/www/webpage/app/storage/views/1154ef6ad153694fd0dbc90f28999013
howto during view-rendering-to-cache save view's path/name (in a comment or something)?
Or better yet - to show it in the debug-error-page (its called whoops or something?)
Thanks ;)

I don't know how to de encrypt view names , but one method i do is to
{{dd('will you reach here ')}}
Trying to move this line from view to another to watch where php render reach .
I know it is not the right way nor the professional one , but it may help in some cases .

This is not exactly a problema, this is a compiled version of your view.
Laravel Blade System will compile all your views and subviews into a single file and, if you didn't change anything on them it will always try to use the compiled version, to speed up your system.
Sometimes is hard to know wich one of our views is related to that error. Using Sublime text, what I do is to hit CTRL-P (windows) and paste the number of the compiled view (1154ef6ad153694fd0dbc90f28999013) and it will bring it to me right away.
Of course, you won't do any changes on it. This is just way to find the view you have problems in, so you can then find the real file and fix it. If you know wich file is the problematic one, you don't have to do this, go directly to your file.

One way to tackle this problem is add a html comments (not blade ones as they will not be rendered in compiled view) in sections which get echoed.
#section('content)
<!-- FILE: app/views/main/index.blade.php -->
<Your Content Goes Here>
#stop
This html comment will get rendered in the compiled source of the view. Of course you will have to inspect the compiled view first to identify which view is the problematic one. But in my experience, this method work almost all the time.

I created a helper that checks to see if you are working locally or in development mode, It then outputs an HTML comment.
{{ printViewComment('mockup/reports#content') }}
<!-- Template: mockup/reports#content -->
I chose to name the comments like this path.file_name#yeild_name but I only wish this was an automated featured.

I found my answer after looking into source,
when on the Whoops! page, just look for render in the sidebar, there will be the name of the view file...

Related

Drupal 8 - Overwriting a specific view page

I have created a view with several pages. As it is displayed to me with the debug mode, I can also use the view:
views-view-fields--foobar.html.twig
Overwrite With me the whole then looks as follows:
views-view-fields--nd-portfolio-filter.html.twig
Now I would like to overwrite a certain page of my view. I can't find anything suitable in debug mode.
According to https://www.drupal.org/docs/8/theming/twig/twig-template-naming-conventions it should work according to the following pattern:
views-view-fields--foobar--page.html.twig
according to this logic it should look like this with me then as follows:
views-view-fields--nd-portfolio-filter--theaterfotos.html.twig
Unfortunately, that doesn't work. "theaterfotos" is the system name of the page of my view.
Do I have a thought error now? Would be grateful for any help.
Thnx Bavra
As of my understanding of your question you want to apply to the template on a specific page of view.
Your logic is right but I think your name was incorrect it should be in this format
[base template name]--[view machine name]--[view display id].html.twig
on your case, it should be like below because views machine name not using "-"(dash in between) on lowercase and underscores
views-view-fields--nd_portfolio_filter--theaterfotos.html.twig
you should try this and clear the cache of drupal. Hope this will helps you
Thanks

trying to find a file to edit the div information

So we have a section on our website (category menu) which was modified to include a custom menu system. in the file top.phtml i found the following code
<div >
<?php //echo $_menu;
echo $nf_menu;
?>
</div>
The code inside the div's is calling for the menu, but i need to edit the actual code of the menu as it has inline styles for z-index applied to it and i need to adjust the z-index number.
Where would i find this menu. does that php code indicate where the file may be? Our coder is gone so we are not sure how they did this.
Based on the very limited information you've provided, there are basic ways of finding out where specific code is being generated in Magento (or any other scripting/php based framework).
View the html source (output) of your menu in a browser and find a piece of the menu HTML that would be unique. An example can be a unique class name or something that will set it apart from everything else.
<ul class="nf-menu">
<li>...
Do a site-wide file search for the unique reference you found in step 1. For example, search for <ul class="nf-menu"> or just nf-menu.
Don't know how to search for text in a file? Use the resources you have available to learn how:
For Linux based machines, see Finding all files containing a text string on Linux
Or if you have the files locally, use an IDE program such as phpStorm or Dreamweaver that includes a folder search for files containing a string of text.
Once you've found the file generating the code, simply make the modifications. I'd recommend making a backup of any file you modify so that you can revert to it if you're changes don't work as intended.

CKEditor with HTML content stores, displays but cannot display for edit

I have used CKEditor for a few years without really understanding it. I now want to use it to display text which will include HTML, CSS, JavaScript and PHP example code. None of that needs to execute it is just to show the code to others.
Currently I used the textarea replace method to edit content and I need to carry on that way. When I add the content first time it is sanitised (mysqli_real_escape_string) and stored in a MySQL database correctly. It also then displays correctly with the CKEditor markup working as markup and the HTML/PHP showing as a code example. However, when I edit the content a second time the HTML examples become "real" HTML and are no longer visible as examples.
For example this:
<?php echo "hello"; ?>
<p>Hello</p>
is correctly (?) stored as:
<p><?php echo "me"; ?></p>
<p><p>Hello</p></p>
and displays on the page as shown in the first code snippet (which is what I want). When I then hit edit again the code examples vanish into the background as real HTML (part of the page). If I put the code examples in as code snippets (which I would rather not have to do because of the intended users) the result in the editor (second edit) looks like this:
<!--?php echo "me"; ?-->
Hello
I am sure i am missing a basic understanding of what is going on behind the scenes but can anyone explain how to allow users to type in text which includes HTML, CSS, JavaScript, PHP and MySQL code examples which must then appear as examples and not markup (and be editable as examples).
I have played with config.entities and config.protectedSource after some research but they do not seem to be relevant (or to work). Weirdly a couple of times it seemed to work fine and I thought I had cracked it but then stopped with no further changes to the config. That means I now have less idea what I am doing than when I started!
You don't mention which version you are using, but if it's relatively new (4.4+) you can use the Code Snippets plugin that was designed exactly for this. See the demo at http://ckeditor.com/demo#widgets. It might help with the encoding issues too. There's docs on it too.
Th help with the current encoding issue, it would help a LOT if you showed us how you output the data and load it into CKEditor. For example "When I then hit edit again" doesn't really describe anything without context. For example, do you use setData() with AJAX? Do you use an inline editor? Code examples would be the best.

How to put space in tab title in dojo?

i am using dojo toolkit with php codeigniter 2.1.0 and i want to put space in tab name wherever necessary.
Anyone has any solution??
My code is :
<div id="setupParty" data-dojo-type="dijit.MenuItem"
onclick="addPartyTab('AddParty');">Manage <u>P</u>arty</div
If i will directly write as :
<div id="setupParty" data-dojo-type="dijit.MenuItem"
onclick="addPartyTab('Add Party');">Manage <u>P</u>arty</div
then it throws error
I want my tab to be displayed with name as "Add Party"
can anyone suggest me solution for this???
Thanx in advance
What error does it throw?
how does the code in addPartyTab look like?
The following should work in any case:
onclick="addPartyTab('Add Party');">
However, this may not be an ideal solution. You need to look into your addPartyTab function to first, ensure the text with embedded space is coming through fine (and i dont see any reason why it shouldnt) and then examine the code in that function to ensure it is being processed correctly - i suspect somewhere in there you will find why it is breaking.
In general, you can set title on a dijit tab (which is typically a contentpane) directly even if the title contains spaces without any issue. Following is a typical way of doing it:
dijit.byId("myTabContentPane").set("title", "Add Party - Hurray!");
where myTabContentPane is the id of the contentpane that makes up that tab

Best Way to Modify Another Programmer's Navigation

"Change an item in the navigation? Sure I can do that in 15 minutes."
So I am trying to update the navigation on a site that I inherited only to find out that the previous programmer was a college student and was using this site as a project of some sort. Needless to say there are zero comments and the code calls function after function and I just can't follow the logic.
I am looking for a roundabout way to update the navigation. I tried using Dreamweaver to search through all of the files in the site and look for any files that contain the name of the page or the url (hoping to find some sort of included file). There was none. I did file text files that control the main navigation but none for the subnavigation.
There is no database.
If it helps here is the site. http://bit.ly/jbs639
And if you want to look at the interesting text file that is parsed to create the main navigation you can find it here: http://bit.ly/m3erna
Hmmm.... Interesting indeed. You have my sympathy.
One thing that I would look at... The file that gets parsed for the main navigation appears to be a simple delimited file. Sure, the delimiter is a rather unusual +++, but that choice means it avoids conflict with things like commas that might be desirable in the link text. It looks as if the last element indicates what type of resource is being accessed (file or directory, although I don't know what - if any - effect that has on the final output). It also appears that there are similar text files (in the framework/cfg/nav/ folder... which should probably not be generally accessible BTW) for the sub-menus. (E.g. the file stores.txt appears to contain the additional navigation items associated with the stores sub-navigation).
You don't mention which sub-menu you're trying to change. I suspect it is the "About TTO" one, which I can't find an entry for... but I'd look to see if there are any similar navigation text files in the /content/about/ folder.
Good Luck!
Of course it was as simple as a function that reads all of the files in the directory and the name of the file. I guess that in this case there was no shortcut.

Resources