Display a variable in a path() - twig

What I have : a variable called url that contains a string and that is sent to the view by controller.
What I want : I must have the following url at the end: https://example.org/url
What I tried : Go to URL
and some stuff.
Of course, it doesn't work.
Can someone can help?

Go to URL
If you put something inside quotes when you are inside twig delimiters it will be considered as a string, here you want to evaluate the variable url, so you simply have to put the name of the said variable and it will be evaluated this way.

Related

Discord JS - How to get image url from JSON?

Hello I am trying to isolate a image - src=\"https:\/\/steamcommunity-a.akamaihd.net\/economy\/image\/6TMcQ7eX6E0EZl2byXi7vaVKyDk_zQLX05x6eLCFM9neAckxGDf7qU2e2gu64OnAeQ7835Ff5GLNfCk4nReh8DEiv5dbPK47pbcyR_m4DQ68Ofs\/62fx62f\" from https://steamcommunity.com/market/listings/252490/Alien%20Red/render?currency=1&format=json and put it into a embed, I am using node fetch to get the overall json from the site how would I go about doing this? I currently have a inefficient way of doing it (getting every character) and it does not work at some points. Any help is appreciated.
There will probably be a better way to do this, but I've thrown this together:
/(?!src=\\?)\"(.*?)\"/g
Just match this with the return and you will have your URL.
If you are making this a static thing (ie. it will be ONLY this image, and will not be editable depending on a command or variable, then just put it as a string & make that the embed's image.
If not, then fetch the contents, then get the results_html portion of it. Then, find where it says "<img" and isolate it until the next ">". Sub string that bad boy from where is says src= to when it sees \" . (or " depending on how it interprets this), and use that sub string as the embed's image attachment.

Custom query string in domino URL

Need a way to pass a value between to pages using URL query strings if possible. However everytime I add "?customquery=customvalue" at the end it ends up to the 404 page of the website.
I want to basically make it look like this.
https://example.com/somedepartment/sample.nsf/page/hello+world?customquery=customvalue
hello+world is a document that is equivalent to a webpage.
I tried this plus a javascript that collects the strings after the number sign and it works.
https://example.com/somedepartment/sample.nsf/page/hello+world#customvalue
However, I couldn't use the hash sign because they told me not to use it and use another unique symbol instead. I am not aware of any symbols that could work the same with hash sign. If there is, please enlighten me.
Apparently, I was able to find an answer.
https://example.com/somedepartment/sample.nsf/page/hello+world?OpenDocument&RandomParam=sample
Now I could pass values by means of this format. Basically it has to be preceded by "OpenDocument" parameter before putting custom ones.
This documentation also helps: http://www.ibm.com/developerworks/lotus/library/ls-Domino_URL_cheat_sheet/

TWIG: What is the similar instruction to PHP's $$var?

I get an array in view and I only know the name (string) of a variable.
I need to evaluate it.
How can I do?
Twig doesn't have variable variables but you can make a twig extension / filter that would sort that problem and it shouldn't be very difficult.
Here is how to do one, in case you haven't been working with this:
http://symfony.com/doc/current/cookbook/templating/twig_extension.html

I can not get string value in php

My php file location is
http://localhost/mysite-Copy/index.php
Here is link to go other page
http://localhost/mysite-Copy/category/Article/money1.php
And in this link I can not get string value when I use code $_Get['id']
I can not get string value in this link
http://localhost/mysite-Copy/category/Article/money1.php
How can I solve this problem?
As your question is really unclear, I guess that you forgot to pass your "id" value into your money1.php, by calling
http://localhost/mysite-Copy/category/Article/money1.php?id=your_id_here
And then get it back in your money1.php with $value = $_GET["id"].
I agree with Big00d. Also, the problem may lie in your html form. You do realise we can't browse to those local links, right?

Codeigniter : how to pass hidden parameters in the url and make them available for parsing

I have an url like this :
www.domain.com/catalog/category_name/category_id/product_name/product_id
example :
www.domain.com/catalog/notebook/93/4_cpu_quad_core/56
and want it to turn into :
www.domain.com/catalog/category_name/product_name/
example :
www.domain.com/catalog/notebook/4_cpu_quad_core
The two ID parameters have to be passed to the application and parsed with PHP as I need it to get the correct category and product.
I have tried several ways using .htaccess and route.php config but no success !!
Can someone explain in simple manner how to pass these parameters to the web server while making these hidden in the url ?
I was just wondering if it is possible to pass hidden parameters in the url and make them available in the backend application (i.e. java or php).
Well! i wrote a function in the file system/core/uri.php
function assing_segment($num,$value)
{
$this->segments[$num] = $value;
return $this->segments[$n];
}
And call to this function either in the view or controller
$this->uri->assing_segment(5,$myvalue);
This will reassign segment 5 with my value
Can someone explain in simple manner how to pass these parameters to the web server while making these hidden in the url ?
There is no way to "hide" parts of the request. You can remove them, but then your application won't see them at all. For example, you can make all your URLs appear to be like www.domain.com/catalog/category_name/product_name/, but your php script isn't going to see anything about any IDs, since they're gone.

Resources