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 4098850
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 20, 20262026-05-20T20:21:23+00:00 2026-05-20T20:21:23+00:00

I’m try to make some changes to my ZenPhoto installation in order so that

  • 0

I’m try to make some changes to my ZenPhoto installation in order so that at the bottom of an album page I have a text area which displays the “embed” code of the generated images above, so that readers can simply copy it and post the html onto their own sites.

Here is the snippet of code.

<?php $str  = ''; ?>
<?php while (next_image()): ?>
    <div class="imagethumb"><a href="<?php echo html_encode(getImageLinkURL());?>" title="<?php echo getBareImageTitle();?>"><?php printImageThumb(getAnnotatedImageTitle()); ?></a></div>

     $str .= '<a href="<?php echo html_encode(getImageLinkURL());?>" title="<?php echo getBareImageTitle();?>"><?php printImageThumb(getAnnotatedImageTitle()); ?></a>;'
<?php endwhile; ?>

<textarea type="text" size="50">
     <?php echo $str; ?>
</textarea>

The code I’ve added is the $str stuff. I’m trying to loop through the images and create the html that is used in the first div in the while loop so that it puts it as text into the str string. This is concatenated for each image in the library and then the end str is posted into a simple text area for the user to copy.

I can’t get the $str concatination working.

I’m very new to php and I can’t quite get the syntax working.

Any help would be much appreciated.

  • 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-05-20T20:21:23+00:00Added an answer on May 20, 2026 at 8:21 pm

    The concatenation is not inside the <?php tags. For readability, you should use sprintf:

    <?php $str  = ''; ?>
    <?php while (next_image()): ?>
        <div class="imagethumb"><a href="<?php echo html_encode(getImageLinkURL());?>" title="<?php echo getBareImageTitle();?>"><?php printImageThumb(getAnnotatedImageTitle()); ?></a></div>
    
         <?php $str .= sprintf('<a href="%s" title="%s">%s</a>', 
                               html_encode(getImageLinkURL()),
                               getBareImageTitle(),
                               printImageThumb(getAnnotatedImageTitle()));
         ?>
    <?php endwhile; ?>
    

    But you are repeating things here (you are creating the link twice). You could restructure the code a bit to avoid that:

    <?php 
       $images = array();
       while (next_image()) {
           $images[] = sprintf('<a href="%s" title="%s">%s</a>', 
                                   html_encode(getImageLinkURL()),
                                   getBareImageTitle(),
                                   printImageThumb(getAnnotatedImageTitle()));
       }
    ?>
    <?php foreach($images as $image): ?>
        <div class="imagethumb"><?php echo $image; ?></div>
    <?php endforeach; ?>
    
    <textarea>
         <?php echo implode("", $images); ?>
    </textarea>
    

    Reference: implode

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

Sidebar

Related Questions

I have a text area in my form which accepts all possible characters from
I have just tried to save a simple *.rtf file with some websites and
That's pretty much it. I'm using Nokogiri to scrape a web page what has
For some reason, after submitting a string like this Jack’s Spindle from a text
I have a string like this: La Torre Eiffel paragonata all&#8217;Everest What PHP function
I have a small JavaScript validation script that validates inputs based on Regex. I
I have a French site that I want to parse, but am running into
I'm parsing an RSS feed that has an &#8217; in it. SimpleXML turns this
I have a reasonable size flat file database of text documents mostly saved in
I'm working with an upstream system that sometimes sends me text destined for HTML/XML

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.