you can only define new functions in layout layers.
these are all global functions.
if you wanted to add them to the string class you would have to declare them like: function string alter_entry(string original) : string { }or function string alter_entry() : string { var string original = $this; }depending on which version of the function you use you would call them as: $e.text-or $e.text->alter_entry();
Re: Sorry to bother you, but...xtomxfallsxMay 7 2005, 22:27:12 UTC
Oh, it's not likely that I'll come up with any nice functions on my own. This S2 stuff is out of my league.
I used what you listed to check for img tags and it works great. I've even got it checking for any instance of [info] with the img tags so that it will ignore lj-user tags.
Unfortunately, using foreach to go through and check the image dimensions is beyond me, so I'll just stick with my half-assed job.
Thanks for your help, though. It allowed me to do basically what I was trying to do.
Re: Sorry to bother you, but...kunzite1May 7 2005, 22:30:47 UTC
could you show me how you use the code that i gave you? i might be able to rig something to search for height and width and extract it. then it would hopefully be able to be used for anything.
Comments 32
Reply
you can only define new functions in layout layers.
these are all global functions.
if you wanted to add them to the string class you would have to declare them like:
function string alter_entry(string original) : string {
}or
function string alter_entry() : string {
var string original = $this;
}depending on which version of the function you use you would call them as:
$e.text-or
$e.text->alter_entry();
Reply
function alter_entry(string original) : string {
var string find = "";
var string replace = "";
var string altered = "";
$find = "http://stat.livejournal.com/img/userinfo.gif";
$replace = "http://pics.livejournal.com/img/fb-userinfo.gif";
$altered = replace_text($original, $find, $replace);
return $altered;
}
Reply
Reply
unofficial? never implemented.
same with alternate(string a, string b) that i could have used today.
Reply
rehtml(string text) : string "Unescape html in \$text by replacing > with > and < with <."
Should probably be: < with > and > with >. It's repeated twice there.
Reply
Reply
For example, say i want to check entries for img tags ("
Reply
if($string->contains("
( ... )
Reply
I used what you listed to check for img tags and it works great. I've even got it checking for any instance of [info] with the img tags so that it will ignore lj-user tags.
Unfortunately, using foreach to go through and check the image dimensions is beyond me, so I'll just stick with my half-assed job.
Thanks for your help, though. It allowed me to do basically what I was trying to do.
Reply
i might be able to rig something to search for height and width and extract it.
then it would hopefully be able to be used for anything.
yay for getting it worked out. :)
Reply
Leave a comment