Page 1 of 1

problem with value comparison and shortcode

Posted: Wed May 26, 2010 2:17 pm
by tharmon0717
Wondering if anyone has ever had to do a work around like this?

basically, I am doing an value comparison with a piece of shortcode from open realty that represents a numeric value. The code looks like this:

Code: Select all

$agent = "{listing_field_ListingAgentName_rawvalue}";
										
$agent1 = "42";
											
if ($agent == $agent1){
												
		echo "agentsname";
}
											
else {
		echo "fail";
}
the only work around I can think of would involve a var dump. Can anyone help me with this?

Re: problem with object comparison and shortcode

Posted: Wed May 26, 2010 2:39 pm
by Eran
I must be missing something here. I see two strings that have no chance of being equal, inside a conditional. Care to elaborate? will $agent actually contain a number in reality?
And what's this about object comparison? did you mean JSON objects?

Re: problem with object comparison and shortcode

Posted: Wed May 26, 2010 2:57 pm
by tharmon0717
pytrin wrote:I must be missing something here. I see two strings that have no chance of being equal, inside a conditional. Care to elaborate? will $agent actually contain a number in reality?
And what's this about object comparison? did you mean JSON objects?
Sorry about that! No objects here...just values. Been up since 4, so I guess it's weighing on me :)

Probably should have explained more about what I'm doing. {listing_field_ListingAgentName_rawvalue} when rendered in browser through one of Open Realty's template files will return a numeric value (or rather the ID of the agent). So yes, if the piece of short code is rendered in the browser, it will return "42" or other possible agent ID's. So, $agent should actually contain a number in reality.
I realize they have no way of being equal inside a conditional, I was just trying to illustrate what I was trying to achieve.

What I need help on is whether or not you can output the shortcode value (ie. "42") into a value to compare with another value. I guess this would probably be done using output control functions, but I can't find any examples that are similar to what I'm doing.

make more sense? Thank you for any help if you understand what I'm trying to do!