[wp-hackers] Using eval within Wordpress for a function mixed with html

chris.hearn01 at ntlworld.com chris.hearn01 at ntlworld.com
Tue Dec 2 13:31:16 GMT 2008


Hi Jacob,
hmmm, yes, you're right, tho I hate to admit it!
The overview is that I run a club website, and they are keen to offer adverts to selected people who also advertise in the club handbook - so these would be sold directly, and it's nothing to do with adsense et al.

So, I have a wordpress-based website, the home page has a left hand sidebar, and I want to display a single column of logos (jpg/gifs, each one will have alt/title text promoting it, and clicking the small logo (approx 100px x 140px) will link to the advetisers website.

In addition, the club want the ads to show in a pseudo random order, so that they can offer them all at same price (rather than "nearer the top costs more" etc).
So i was planning to use same concept as the ad-rotator plugin, storing the info for each "advert" in a text file.
At this stage I was then going to hand-craft the details in the text file for any adverts that are sold, rather than write an admin interface - I don't know how sucessful the club will be in this yet, so may be too much work to write a full friendly interface.
The images would be stored on my wordpress site, and to keep it flexible I do not want to hardcode the image locations, but make it relative to bloginfo("wpurl"), in case the adverts are successfull and/or my site location moves. Also eases testing on my locahost and website.

So that is the overview, I would welcome your thoughts
Thanks
Chris

> 
> From: Jacob Santos <wordpress at santosj.name>
> Date: 2008/12/02 Tue AM 04:55:11 GMT
> To: wp-hackers at lists.automattic.com
> Subject: Re: [wp-hackers] Using eval within Wordpress for a function mixed
> 	with html
> 
> You're problem appears to be that you are programming when you should be 
> developing. Take for example your situation. You want a complex solution 
> to a simple problem. If you were a developer, you would use the simple 
> solution for the simple problem. The simple solution would be one that 
> does not involve eval(). I think that if you gave us more code, we'd be 
> able to get to the root of your problem and fix the cause instead of 
> implementing something to cover it up.
> 
> Jacob Santos
> 
> 
> Chris wrote:
> > Hi
> > I want to evaluate the string below within myfunc() and return a 
> > result ready to drop into my home page (echo $s;)
> >
> > For reasons I won't bore you with I want to store this fragment in a 
> > text file.
> > Have bashed my head with all sorts of variants, but cannot get eval() 
> > to work!
> >
> > The bit that works directly in a page is this:
> > '<a rel="external nofollow" 
> > href="'.get_bloginfo('wpurl').'/juniors/mirror"><img 
> > src="/oldsite/images/junior/.thumbs/.mirror.jpg" alt="mirror.jpg" 
> > title="mirror.jpg" width="95%" /></a> <hr />';
> >
> > How to use eval() to get the proper result from this type of thing:
> > Assuming I read the above fragment from a text file into variable $s
> >
> > function myfunc($s)
> > eval('\$theresult= \$s;')
> > return $s;
> >
> > So any help would be MUCH appreciated!
> >
> > Best regards from the UK!
> > Chris
> >
> >
> 
> _______________________________________________
> wp-hackers mailing list
> wp-hackers at lists.automattic.com
> http://lists.automattic.com/mailman/listinfo/wp-hackers
> 

-----------------------------------------
Email sent from www.virginmedia.com/email
Virus-checked using McAfee(R) Software and scanned for spam



More information about the wp-hackers mailing list