I'm trying to take an elgg view... and edit the string before outputing:
$temp = elgg_view('output/url', array('value' => $theMedia1));
Then do some string modifications, then output
echo $temp;
However, I am unable to do anything string operations on $temp ie: When I try to output a substring of it, I get nothing... I can't pattern match anything with it.
Is elgg_view outputing a string variable? How can I do this modification?
Appreciate any help.
info@elgg.org
Security issues should be reported to security@elgg.org!
©2014 the Elgg Foundation
Elgg is a registered trademark of Thematic Networks.
Cover image by RaĆ¼l Utrera is used under Creative Commons license.
Icons by Flaticon and FontAwesome.
- Juho Jaakkola@juho.jaakkola
Juho Jaakkola - 0 likes
- ameetnsharma@ameetnsharma
ameetnsharma - 0 likes
- Juho Jaakkola@juho.jaakkola
Juho Jaakkola - 0 likes
- ameetnsharma@ameetnsharma
ameetnsharma - 0 likes
- Juho Jaakkola@juho.jaakkola
Juho Jaakkola - 0 likes
- ameetnsharma@ameetnsharma
ameetnsharma - 0 likes
- Juho Jaakkola@juho.jaakkola
Juho Jaakkola - 0 likes
- ameetnsharma@ameetnsharma
ameetnsharma - 0 likes
You must log in to post replies.Yes, elgg_view() returns a string.
Is the example above is your actual code of just an example? Because...
is not a valid parameters array for output/url view. At minimum it needs either the parameter "href" or "text".
Hi Juho. Thanks, this actually helped me out. I put in href instead of 'value". I can actually output substrings now.
But I'm unable to get any preg_match to work.
Here's my code:
$temp= elgg_view('output/url', array('href' => $theMedia1));
if(preg_match("/div/", $temp))
echo "YES MATCH!";
It never works. But if I actually echo $temp, I can see the div... not sure what to do.... if I concatenate a string to the front:
$temp = "test".elgg_view('output/url', array('href' => $theMedia1));
Then doing a preg match of "test" in $temp will work... but nothing in the view is found.
Could you explain what exacty you are trying to achieve by editing the string? What is the "problem" that you are trying to solve?
I'm trying to replace a div id='embedvideoembed_52414884c03fc' with div id ='media1'
What is the output of that particular elgg_view() call when you print it? Paste here the whole output.
Ok, you are doing something really weird. Most of those tags are not even allowed to be used inside an <a> tag. You should really consider a completely different approach for whatever you're trying to achieve by editing the link id.
The output is from a plugin... embed extender. I assumed I was supposed to use output/url to output an embedded video object.
Anyways, thanks for your help.