Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8363119
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 9, 20262026-06-09T12:06:13+00:00 2026-06-09T12:06:13+00:00

I want to print list of image address in jquery function using php(adodb) and

  • 0

I want to print list of image address in jquery function using php(adodb) and smarty.

i need to this :

 $.lightbox(["/media/photos/tmb/4.jpg", "/media/photos/tmb/3.jpg", "/media/photos/tmb/6.jpg"]);

i try with this (just simple for test) :

 {/literal} {if $photos} $.lightbox(["{"\", \""|implode:$photos}"]); {/if}{literal}

result is :

 $.lightbox(["Array", "Array", "Array", "Array", "Array", "Array", "Array", "Array", "Array", "Array", "Array"]); 

Actually, i need to replace array with images address.

images address (dynamic loop) :

{$relative}/media/photos/tmb/{$photos[i].PID}.jpg

without jquery function, i list images with this methods :

{if $photos}
{section name=i loop=$photos}
{$relative}/media/photos/tmb/{$photos[i].PID}.jpg
{/section}
{/if}

php code:

    $sql            = "SELECT PID, caption FROM photos WHERE AID = " .$aid. " AND status = '1' LIMIT " .$limit;
    $rs             = $conn->execute($sql);
    $photos         = $rs->getrows();
    $smarty->assign('photos', $photos);

how to print list for my need? can i?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-09T12:06:15+00:00Added an answer on June 9, 2026 at 12:06 pm

    The easiest thing to do is assign the array to your template, and use json_encode(). I don’t use Smarty very often, but I believe you can just do:

    {$yourImageArray | json_encode}
    

    Edit: Now that you’ve finally told us what your array contains:

    Array ( [0] => Array ( [0] => 13 [PID] => 13 [1] => => ) [1] => Array ( [0] => 14 [PID] => 14 [1] => => ) [2] => Array ( [0] => 15 [PID] => 15 [1] => => ) [3] => Array ( [0] => 30 [PID] => 30 [1] => salam => salam ) [4] => Array ( [0] => 17 [PID] => 17 [1] => => ) [5] => Array ( [0] => 31 [PID] => 31 [1] => => ) [6] => Array ( [0] => 32 [PID] => 32 [1] => => ) [7] => Array ( [0] => 33 [PID] => 33 [1] => => ) [8] => Array ( [0] => 34 [PID] => 34 [1] => => ))

    Here’s what you need to do. In your controller:

    $photoFileNames = array();
    foreach ($photos as $photo) {
        $photoFileNames[] = $photo['PID'];
    }
    
    $smarty->assign('photoFileNamesJSON', json_encode($photoFileNames));
    

    In your template, you can access the array via $photoFileNamesJSON. The next time you post a question, please include all of the information from the start. It will be much easier to provide a more specific answer, if you are specific with your question.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I want to print an integer number in binary mode using following function: #include
i have a list of posts. i want print some words of post content
I am having issues trying to print a list in python. I want to
I want to print the ID of the comment (eg. 10151828637085391_33268745 ) from this
I want to print all the prime numbers between two numbers. This is my
I want to capture the ouput of dpkg --list | grep linux-image in Python
I want to upload an image using a groovy on grails. My gsp page
I am using jQuery mobile and I am trying to center some image icons
Here's some sample code that I want to control using jQuery (white button bg
I am using the AjaxForm() call from jquery.form.js to attempt to run a php

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.