nepateemu Posted August 14, 2012 Report Share Posted August 14, 2012 Taisu izsaukumu no joomlas 2.5 datubāzes, kur ir lauks images, lai varētu image_intro vērtību ielikt tālāk <img src="<?php echo $image ;?>">, taču kko acīmredzami daru nepareizi.. Meiģinājums # 1: echo "<pre>"; print_r( htmlspecialchars($images)); echo "</pre>"; Rezultāts # 1 <pre>{"image_intro":"images\/interview\/05229.jpg","float_intro":"","image_intro_alt":"", "image_intro_caption":"","image_fulltext":"images\/interview\/05229.jpg","float_fulltext":"","image_fulltext_alt":"", "image_fulltext_caption":""}</pre> Meiģinājums # 2: <img src="<?php echo htmlspecialchars($images->image_intro); ?>" alt="<?php echo htmlspecialchars($images->image_intro_alt); ?>"/> Rezultāts # 2 <img src="/test/ Notice: Trying to get property of non-object in C:\Apache2\docs2\test\templates\ne\index.php on line 78 " alt=" Notice: Trying to get property of non-object in C:\Apache2\docs2\test\templates\ne\index.php on line 78 "/> Meiģinājums # 3 echo $images['image_intro']; Rezultāts # 3 { Pats query {"image_intro":"images\/06592.jpg","float_intro":"","image_intro_alt":"","image_intro_caption":"","image_fulltext":" ","float_fulltext":"","image_fulltext_alt":"","image_fulltext_caption":""} Quote Link to comment Share on other sites More sharing options...
briedis Posted August 14, 2012 Report Share Posted August 14, 2012 uzraksti print_r(json_decode($images)); Quote Link to comment Share on other sites More sharing options...
nepateemu Posted August 14, 2012 Author Report Share Posted August 14, 2012 uzraksti print_r(json_decode($images)); deva stdClass Object ( [image_intro] => images/interview/05229.jpg [float_intro] => [image_intro_alt] => [image_intro_caption] => [image_fulltext] => images/interview/05229.jpg [float_fulltext] => [image_fulltext_alt] => [image_fulltext_caption] => ) Bet velarvien rokas par iisu man.. Meiģināju turpināt ar $bilde = print_r(json_decode($images["image_intro"])); <img src="<?php echo $bilde; ?>"/> Rezultāts: <img src="/test/1"/> Quote Link to comment Share on other sites More sharing options...
waplet Posted August 14, 2012 Report Share Posted August 14, 2012 $images = json_decode($images); <img src="<?php echo $images['image_intro'];?>"/> vai $images->image_intro; Quote Link to comment Share on other sites More sharing options...
briedis Posted August 14, 2012 Report Share Posted August 14, 2012 nepateemu, esi parādā vienu cepumu wapletam :) Quote Link to comment Share on other sites More sharing options...
nepateemu Posted August 14, 2012 Author Report Share Posted August 14, 2012 (edited) Juuuhuu, ir. Paldies Cepumus visiem uz manu reiķinu!! Sho paaris stundas pētiju, līdz sadūšojos lūgt palīdzību. Edited August 14, 2012 by nepateemu Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.