vscode : problem with format laravel blade inside javascript - laravel

I try to use blade functions inside javascript but formating result is very Irregular and illegible
And what's worse is that after formatting vscode create white spaces between text and the code does not run
how can fix this
before format :
befor format
after format :
after format

I found that the Laravel-Blade by amirmarmul formatted blade directives in JavaScript. like this
var global = {
!!str_replace('"', '', json_encode($global))!!
};
And this would result in an error expected property name, got '!'.
I uninstalled it, and instead installed this one. Now formatting is as expected with the blade directives in HTML being formatted correctly while those in JavaScript remain untouched.

Related

How to display my tinymce text into my html view

I save into my database the text which I write into a textarea with tinymce.
What I'm trying to do now, is to display this content into my view. Right now, when I'm doing {{$article->contenu}} i've this :
Is there a way to display my tinymce content into my view with the correct format please (not inside a textarea) ?
Content from TinyMCE is saved as an HTML string. You are passing that HTML content to Laravel's templating engine as a variable, and asking it to to be rendered. By default Laravel does not automatically render HTML, to prevent XSS attacks.
However, if you use this syntax instead:
{!! $article->contenu !!}
...the content should render as expected. For more info, check the Laravel docs:
https://laravel.com/docs/5.6/blade#displaying-data

How to fix 'Link Highlighting in Inline Code'?

The method of writing a code element in Asciidoc is by writing an element enclosed in the grave accent(`):
`var`
And, the method to show a link is:
link:www.awebistelink.com[var]
I am attaching an image to show these two on a website that renders Asciidoc
Image Displaying the output in an asciidoc document
When I am trying to show a link highlight of a code element inside an inline code by writing:
`link:www.awebistelink.com[var]`
It renders perfectly fine on Asciidoc Please see it here
But on the website, it doesn't show any link, and simply shows a code element like as if we declared it simply as
`var`
The correct way to make a link label appear in monospace is to apply the backticks to the label itself, not the link.
Using your example, the markup should be:
link:www.awebsitelink.com[`var`]
I found the answer,
it should be
`link:www.awebistelink.com[var]`
I still don't know how it worked but now it works just fine as intended.

I want to display predefined HTML in a variable

I am using Codeigniter and everything works just fine. I can assign PHP variable to smarty an display them.
But now I am calling a webservice and this webservice returns a complete HTML (and javascript) page.
I want to display this in a smarty template.
So I have done the following:
I have assigned the output of the webservice to a PHP variable and assigned this to a smarty variable (HTMLstring), like I always do. That part works.
In my smarty template I don't need anything but to display the contents of the variable. So my template contains just one line:
{HTMLstring}
But this displays the literal HTML including tags and all. I want to display the output.
(If I copy-paste the output in a separate html file, and open that, it just looks fine)
I 'figured out' the answer.
It appears it makes a difference if I call the template from code or just type the complete url in my browser for testing purposes. The latter didn't work, the former does. I still don't know why. Sorry...
Question closed.

regarding image downloading function

Can anyone help me to solve my issue regarding the image downloading function? The situation goes like this: actually I wanna download a gantt chart image from a site that generates some string url as the image! not even http://www.example.com/img/image.png but something like http://www.example.com/img/index.php?=task&d=&Work=0...
Disregarding what language or environment you are working in, simply using the full URL with all the GET variables in place will provide you with the image.
It should not matter.
Judging from your comments below, your code is not working because you are using PHP's htmlspecialchars function.
Htmlspecialchars will turn symbols that you cannot represent in HTML output simply by adding them to the source of an html document (such as &, < and >) into identifiers that will let the browser know what kind of character to render.
for instance the ampersand (&) could be rendered by & the HtmlSpecialChars function does this for you.
When your backend code is outputting parts of html source that aren't visible to the user, such as the source of an image in this case, you do not want to use that function.
It will invalidate the URL by replacing all the & instances in the url by &
Simply do this:
<?php print($url); ?>

FCKeditor: displays the formating characters along with text

have a form that uses FCKeditor. I can input with formatting, but when I bring back what I put in FCKeditor it also displays the raw html format syntax. I.E. <p><p>&
Question: is there a setting I'm missing that uses the formatting to format the text instead of displaying the formatting syntax along with the text?
thanks
Randy
i dont know whether you are using ASP.net C# or not but if yes then first import
using System.Text.RegularExpressions;
using FredCK.FCKeditorV2;
these two things and then where you are retrieving your value from fckeditor then use
string fckContent = Regex.Replace(FCKEditorID.value, #"<(.|\n)*?>", string.Empty);

Resources