charliez Posted March 19, 2012 Share Posted March 19, 2012 I created a repeater in my SEO tab for my META statements (I know they are not fashionable anymore, but I still use them). I am trying to access them like this: <?php foreach($page->Meta as $m) { echo "<meta name='$m->$MetaName' content='$m->$MetaContent' /><br/>"; } ?> but I get this: <meta name='1011->' content='1011->' /><br/><meta name='1012->' content='1012->' /><br/><meta name='1013->' content='1013->' /><br/><meta name='1014->' content='1014->' /><br/><meta name='1015->' content='1015->' /><br/><meta name='1016->' content='1016->' /><br/><meta name='1017->' content='1017->' /><br/><meta name='1018->' content='1018->' /><br/><meta name='1019->' content='1019->' /><br/> What am I doing wrong? If I use the variables inside a <p>, they work fine printing out... I am a noob... be gentle please... Link to comment Share on other sites More sharing options...
Soma Posted March 19, 2012 Share Posted March 19, 2012 Try this without the $ in the field name? <?php foreach($page->Meta as $m) { echo "<meta name='$m->MetaName' content='$m->MetaContent' /><br/>"; } ?> or this with the {} <?php foreach($page->Meta as $m) { echo "<meta name='{$m->MetaName}' content='{$m->MetaContent}' /><br/>"; } ?> Link to comment Share on other sites More sharing options...
charliez Posted March 19, 2012 Author Share Posted March 19, 2012 Thanks Soma, that was it! What a basic mistake... well... thanks again... Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now