Add another text field beyond description?

Permalink Browser Info Environment
Hi, great plugin!

Would it be possible to add another text field besides description? For example adding a tags field....I don't mind messing with things to figure it out on my own if you could point me to which files might need to be edited I could take a try myself...

Thanks!

Type: Discussion
Status: New
mikepinto81
View Replies:
jordanlev replied on at Permalink Reply
jordanlev
Hi Mike,
Glad you like the plugin. I need a little more clarification from you about what exactly it is you want this to do, because I'm not sure I understand. The description is a requirement of the concrete5 system and gets displayed in the dashboard's "Add Functionality" page. You want to add another textbox to do what exactly (in other words, what function would these tags serve)?
mikepinto81 replied on at Permalink Reply
mikepinto81
sorry for being unclear...

When the photo is displayed, it displays the description you enter on the back-end under the picture. I'd like to add another field that would show up also under the picture that I could style with css to be different then the description text. So you would have Picture and under the pic the description and then another field of text that works the same as description but I can style separately from description with css.
Does that make sense?

thanks!
mikepinto81 replied on at Permalink Reply
mikepinto81
sorry, I used the word description when really I meant Caption! my bad!
jordanlev replied on at Permalink Reply
jordanlev
Sure, when you're creating the block you can just add another text field, give it a label of "Caption", and put appropriate wrapper HTML around it so that you can style it via CSS to be placed where you want under the image.
mikepinto81 replied on at Permalink Reply
mikepinto81
Thanks I pretty much got it!
mikepinto81 replied on at Permalink Reply
mikepinto81
I got it to work in the back-end by editing all the php files but now I want to display the Title, Caption, and my new Tags field in the fancybox window and have them all have separate div classes for css styling.
I don't know any javascript so i'm finding it quite difficult trying to edit the fancybox js file. Is there an easy way to just display those fields as html elements in the fancybox window? Preferebly inside these divs....I'll do the styling myself, I just need them to be there below the image....
<div class="fancyTitle"></div>
<div class="fancyTags"></div>
<div class="fancyCaption"></div>

If this request is outside the scope of the license fee, please let me know if I could pay you extra. Thank You!
jordanlev replied on at Permalink Reply
jordanlev
Umm... this is really embarrassing, but I must apologize because until today I thought you were talking about a different addon of mine ("Designer Content"). I am very sorry about this as it means I wan't actually giving you helpful advice. Honestly I'm surprised (and impressed) that you were able to get so far with my pretty much non-sensical responses!

So you've actually figured out how to add new fields to the block -- that's great! The challenge is that fancybox by default only displays the link's "title" attribute as the caption so by default there's no way to get html in there. But there is a workaround which I've used before -- first you put all of your caption comment in a div that directly follows the <a> tag for the image, for example inside the "$images" loop (in the block view.php file) you could have this:
<?php if ($enableLightbox): ?>
<a href="<?php echo $img['full_src']; ?>" rel="<?php echo $rel; ?>">
<?php endif; ?>
<?php echo $html->image($img['thumb_src'], $img['thumb_width'], $img['thumb_height'], array('border' => '0', 'alt' => $img['title'])); ?>
<?php if ($enableLightbox): ?>
</a>
<div class="image_gallery_caption" style="display: none;">
    <span><?php echo $img['description']; ?></span>
    <br />
    <span style="color: red;"><?php echo $img['tags']; ?></span>
</div>
<?php endif; ?>

(Note that we've taken out the "title" attribute from the <a> tag. Also note that I'm using a hypothetical "$img['tags']" variable -- you would need to populate this in the block controller -- let me know if you need help with that too).

Then, you tell fancybox to use this html by putting in a special function into the "onStart" callback when you declare the fancybox. So make the javascript code in the view.php file something like this:
<script type="text/javascript">
$(document).ready(function(){
   $('a[rel="<?php echo $rel; ?>"]').fancybox({
      'transitionIn' : '<?php echo $lightboxTransitionEffect; ?>',
      'transitionOut' : '<?php echo $lightboxTransitionEffect; ?>',
      'titleShow' : <?php echo $lightboxTitlePosition == 'none' ? 'false' : 'true'; ?>,
      'titlePosition' : '<?php echo $lightboxTitlePosition; ?>',
      'onStart': function(currentArray,currentIndex,currentOpts) {
         var obj = currentArray[ currentIndex ];
         if ($(obj).next().length) {
            this.title = $(obj).next().html();
         }
      }
   });
});

(That code just says that when each lightbox opens or is navigated to with the arrows, it should find the element that immediately follows the image link -- which in our case is that "image_gallery_caption" div -- and stuff that into the title).

Hope that helps -- please don't hesitate to post back with more questions if you run into trouble.

Thanks for your patience.

-Jordan
mikepinto81 replied on at Permalink Reply
mikepinto81
awesome, thank you! I think I have it, i'll post a link to my results once I finish for everyone to see....
adajad replied on at Permalink Reply
adajad
So did you get this fixed? I'm also interested in adding more information for each image (like photographer, venue, designer, date or whatever is needed) and would like to see if it's even possible before I buy this add-on.
mikepinto81 replied on at Permalink Reply
mikepinto81
I actually did get this to work. It is a little complicated of a modification. There are a bunch of files that need to be edited, but it IS possible. Unfortunately I can't post a link yet because the site is not launched I used it for. As far as how to do it, the dev is super responsive and helpful!
adajad replied on at Permalink Reply
adajad
Wow, that was quick!?

I don't mind editing code to get it to work (even if I'm not a programmer), I just need to know if it's possible before I'm getting my hands dirty...

Do you happen to have a screen shot of an expanded image with caption and tags, just so I could get a feel for it?

Edit: I just bought it since I feel confident I'll be manage to edit it to my likings.
adajad replied on at Permalink Reply
adajad
Just to make sure... do I need to manually update the db tables with my added attributes or is there an easier way to accomplish this edit?

I get sql error telling me the column doesn't exist (which isn't that strange when you think about it), and since the tables in db.xml are created on install I suspect I need to manually create the columns.

>> 'mysql error: [1054: Unknown column 'customer' in 'field list'] in EXECUTE("INSERT INTO btDeluxeImageGalleryProperties (bID, fID, position, title, caption, customer) VALUES ('275', 3', 1, 'image.jpg', 'sample caption', 'test customer name')")'


Please correct me if I'm wrong, and if so could you point me to the correct file where to make the changes? I have followed all instructions in this thread so far and added/changed a bunch of rows in several files already, which is showing me the extra text fields I want.
jordanlev replied on at Permalink Reply
jordanlev
When you say "added attribute" I assume you mean that you added new fields to the db.xml file. If that's correct, then you can have C5 update the schema for you by going to Dashboard -> Add Functionality, click the "Edit" button next to "Deluxe Image Gallery", then click the "Edit" button over to the right side of the screen, then click the "Refresh" button (be careful not to click "Remove" by accident!).

Let me know if you have any other questions.
adajad replied on at Permalink Reply
adajad
That did the trick and no exceptions were thrown. No I just need to get the lightbox effect to work again, since something I changed seems to have thrown it out the window. Probably when I was making the changes in view.php.

Thanks a lot for your quick reply!

concrete5 Environment Information

Browser User-Agent String

Hide Post Content

This will replace the post content with the message: "Content has been removed by an Administrator"

Hide Content

Request Refund

You have not specified a license for this support ticket. You must have a valid license assigned to a support ticket to request a refund.