Jump to content
php.lv forumi
Sign in to follow this  
nepateemu

vajadziiga paliidziiba ar array izsaukumu

Recommended Posts

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":""}

Share this post


Link to post
Share on other sites

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"/>

Share this post


Link to post
Share on other sites

$images = json_decode($images);


<img src="<?php echo $images['image_intro'];?>"/>

vai

$images->image_intro;

Share this post


Link to post
Share on other sites

Juuuhuu, ir. Paldies

Cepumus visiem uz manu reiķinu!! Sho paaris stundas pētiju, līdz sadūšojos lūgt palīdzību.

Edited by nepateemu

Share this post


Link to post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
Sign in to follow this  

×
×
  • Create New...