Answers.Body: <p>Use the <code>~</code> symbol to concat strings.</p>
  
  <pre><code>//loop through all database entries
  {% for val in entries %}
      .....
      &lt;a href="{{ url('pluginName/editEntry/' ~ val.id) }}"&gt;Edit&lt;/a&gt;
      .....
  {% endfor %}
  </code></pre>
  
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2016-11-09T14:07:10.423Z
Answers.Text: thank you, could you tell me if there is a better way to get the id in php except `craft()->request->getUrl();` and exploding the string?
Answers.UserDisplayName: Robin Schambach
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2016-11-09T14:24:06.490Z
Answers.Text: There is a a cheat sheet: https://straightupcraft.com/articles/cheat-sheet-craft.request .   Maybe `craft->request->getSegment(n);`
Answers.UserDisplayName: spAnser
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2016-11-09T14:29:34.077Z
Answers.Text: I already saw that but I don't know how to use it... getSegment is always null... seems like I'll just use the substring method
Answers.UserDisplayName: Robin Schambach
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2016-11-09T13:59:26.383Z
Answers.LastActivityDate: 2016-11-09T13:59:26.383Z
Answers.UserDisplayName: spAnser
Body: <p>I would like to create a link to another page in my plugin and send a specific ID with it but I don't really know how to do it in craft and twig.. I spend too much time on that little task and searched in the internet but could not really find something.</p>
  
  <p>In my template I have </p>
  
  <pre><code>//loop through all database entries
  {% for val in entries %}
      .....
      &lt;a href="{{ url('pluginName/editEntry/' + val.id) }}"&gt;Edit&lt;/a&gt;
      .....
  {% endfor %}
  </code></pre>
  
  <p>But it does not really work. How can I pass a specific id in my url and how can I receive this parameter in my php backend?
  I didn't find something like <code>craft()-&gt;request-&gt;getGetVar()</code>and my <code>$_GET</code> is always empty. Of course I could just take the URL and use subtring and explode to get the correct value but I'm not sure if this is the intended way</p>
  
Tags: <plugin-development><templating>
Title: Twig create link with variable
ThreadText: # Twig create link with variable
  
  (Asked by: username_0 on 2016-11-09)
  
  I would like to create a link to another page in my plugin and send a specific ID with it but I don't really know how to do it in craft and twig.. I spend too much time on that little task and searched in the internet but could not really find something.
  
  In my template I have
  
  ```
  //loop through all database entries
  {% for val in entries %}
      .....
      <a href="{{ url('pluginName/editEntry/' + val.id) }}">Edit</a>
      .....
  {% endfor %}
  
  ```
  
  But it does not really work. How can I pass a specific id in my url and how can I receive this parameter in my php backend?
  I didn't find something like `craft()->request->getGetVar()`and my `$_GET` is always empty. Of course I could just take the URL and use subtring and explode to get the correct value but I'm not sure if this is the intended way
  
  **Tags:** plugin-development, templating
  
  
  ---
  
  ## 1 answers
  
  ### Answer by username_1 on 2016-11-09. Score: 4
  
  Use the `~` symbol to concat strings.
  
  ```
  //loop through all database entries
  {% for val in entries %}
      .....
      <a href="{{ url('pluginName/editEntry/' ~ val.id) }}">Edit</a>
      .....
  {% endfor %}
  
  ```
  
  > **Comments:**
  > **username_0**: thank you, could you tell me if there is a better way to get the id in php except `craft()->request->getUrl();` and exploding the string?  
  > **username_1**: There is a a cheat sheet: https://straightupcraft.com/articles/cheat-sheet-craft.request .   Maybe `craft->request->getSegment(n);`  
  > **username_0**: I already saw that but I don't know how to use it... getSegment is always null... seems like I'll just use the substring method  
  
  ---
  
  