problem with value comparison and shortcode

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
tharmon0717
Forum Newbie
Posts: 2
Joined: Wed May 26, 2010 1:48 pm

problem with value comparison and shortcode

Post 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?
Last edited by tharmon0717 on Wed May 26, 2010 3:20 pm, edited 2 times in total.
User avatar
Eran
DevNet Master
Posts: 3549
Joined: Fri Jan 18, 2008 12:36 am
Location: Israel, ME

Re: problem with object comparison and shortcode

Post 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?
tharmon0717
Forum Newbie
Posts: 2
Joined: Wed May 26, 2010 1:48 pm

Re: problem with object comparison and shortcode

Post 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!
Post Reply