How to use url variables in content
-
- Jr. Bludit
- Posts: 7
- Joined: Sat Jul 10, 2021 4:22 am
Hello ! i have a question, i would like to print url variables inside a post like $get or something.. how can i do it ?
I know now that i can use echo $url->parameter('user'); but it prints in all the pages , not content.
I need to use this variables by editing posts with several variables inside the post, how can i do it ?
I know now that i can use echo $url->parameter('user'); but it prints in all the pages , not content.
I need to use this variables by editing posts with several variables inside the post, how can i do it ?
- Edi
- Site Admin
- Posts: 3121
- Joined: Sun Aug 09, 2015 5:01 pm
- Location: Zurich
- Has thanked: 54 times
- Been thanked: 77 times
- Contact:
Use JavaScript. You can find several tutorials with a search for "get url parameters javascript".altomarketing wrote: ↑Sat Jul 10, 2021 4:32 am I need to use this variables by editing posts with several variables inside the post, how can i do it ? :
Clickwork - Websites mit Bludit | Planet Bludit - Tipps und Snippets
-
- Jr. Bludit
- Posts: 7
- Joined: Sat Jul 10, 2021 4:22 am
This does not work in post in bluidit
what im missing ?
what im missing ?
Code: Select all
<script language="javascript" type="text/javascript">
$.urlParameters = function(params) {
var results = new RegExp("[?&]" + params + "=([^&#]*)").exec(
window.location.href
);
return results ? decodeURI(results[1]) : null;
};
document.write("variable uno is ", $.urlParameters("variable1"));
document.write(", ", $.urlParameters("variable2"));
</script>
</p>
-
- Jr. Bludit
- Posts: 7
- Joined: Sat Jul 10, 2021 4:22 am
I tested this three > https://www.codegrepper.com/code-exampl ... ing+jquery
None works inside the post, do you have any example to help me ?
- Edi
- Site Admin
- Posts: 3121
- Joined: Sun Aug 09, 2015 5:01 pm
- Location: Zurich
- Has thanked: 54 times
- Been thanked: 77 times
- Contact:
What do you want do do? Where is the string enviar-metadata from? Bludit does normally not use such strings.
Clickwork - Websites mit Bludit | Planet Bludit - Tipps und Snippets
-
- Jr. Bludit
- Posts: 7
- Joined: Sat Jul 10, 2021 4:22 am
metadata is an fiendly url example .
See my first post (image), i want to use url variables to write it inside the post.
Live Example : http://serviciostreaming.com/manual/pru ... =joseperez
I want to post Hola joseperez , insted of Hola %user
See my first post (image), i want to use url variables to write it inside the post.
Live Example : http://serviciostreaming.com/manual/pru ... =joseperez
I want to post Hola joseperez , insted of Hola %user
- Edi
- Site Admin
- Posts: 3121
- Joined: Sun Aug 09, 2015 5:01 pm
- Location: Zurich
- Has thanked: 54 times
- Been thanked: 77 times
- Contact:
You can use something like this:
For the ouput see also:
https://www.w3schools.com/js/js_output.asp
Code: Select all
<script>
url = window.location.href;
str = url.indexOf("user");
name = url.slice(str+5);
document.write(name);
</script>
https://www.w3schools.com/js/js_output.asp
Clickwork - Websites mit Bludit | Planet Bludit - Tipps und Snippets
-
- Jr. Bludit
- Posts: 7
- Joined: Sat Jul 10, 2021 4:22 am
EDI !!!
YOU ROCK !!
SOS LO MAS GRANDE QUE HAY !!!
thanks !!!
It works like charm !!
YOU ROCK !!
SOS LO MAS GRANDE QUE HAY !!!
thanks !!!
It works like charm !!
-
- Jr. Bludit
- Posts: 7
- Joined: Sat Jul 10, 2021 4:22 am
Just for record, after i learn.
This solution is compatible with multiples variables in url:
This solution is compatible with multiples variables in url:
Code: Select all
<script>
url = window.location.href;
dato1 = url.split( 'user=' )[1];
dato2 = dato1.split( '&' )[0];
document.write(dato2);
</script>