Pages (2): 1 2   
Member
Member
Jan   2006-08-29, 22:11
#1

Hey there!

I've been using zenphoto for quite some time now, and I'm very satisfied with it, but there's one thing that would make it even better: a message that prints out "No description" in case a description for an image doesn't exist! I suppose this shouldn't be very difficult to do in the theme itself for those with better knowledge in PHP than me, and that's why I'm humbly asking if someone could help me out. Anyone?

Member
Member
barista   2007-01-08, 02:31
#2

I think if you go into the database, you should be able to set a default description. I haven't taken that close of a look at the database setup for ZP, but I would think it's possible to set a default. I don't know your particular hosting setup, but I would recommend using phpMyAdmin or something similar.

Developer
Developer
trisweb   2007-01-15, 21:56
#3

It's better to do this in the theme: if (getDesc() == "") echo "No Description"; or something like that (I forget the exact syntax).

It's best to keep it blank in the database; otherwise there's no way to actually know if there actually is a description or not.

Member
Member
Jan   2007-01-20, 19:23
#4

Thanks for replying! I did it like this, and it seems to be working pretty good:

``

Have a nice weekend.

Developer
Developer
trisweb   2007-01-21, 08:18
#5

Perfect, that's how I'd do it. Thanks for replying

Member
Member
fiction   2008-06-19, 11:25
#6

To only show the description if it exists:

`

`

(for image descriptions, swap getAlbumDesc for getImageDesc)

Member
Member
CR   2008-09-29, 23:14
#7

Hi, I know this is a really old topic but I for one have found it very useful - thanks peeps However, although the above code works as advised I have found the following little issue:

When using the following code it shows 'No description added yet!' as it should but I can no longer edit the description using the in-built AJAX functions.

``

However, once a description has been added by myself via the main admin section I can still edit it as normal on-the-fly.

Does anyone know how to make it so that I can still edit the description while viewing the image by clicking on the 'No description added yet!' as per the above code?

Please help as I really want to show when there is no description but still require the function to be able to edit it using AJAX if thats clear...

Thanks, CR

Member
Member
sbillard   2008-09-30, 00:18
#8

That is because when you do not call the printImageDesc(true) function you do not get the Ajax code.

A better solution to your problem would be to use phpMyAdmin to insert 'No Description' into any record which currently has an empty description.

Member
Member
CR   2008-09-30, 09:47
#9

Hi sbillard, thanks for the advice - although I know how to add the record you speak of, I do not know how to do the initial check and also replace the data when a comment has been added.... Any chance you could help?

Failing this, how hard would it be to add the 'No description' text to the AJAX code so that when it says 'Click to add a description...' it could be 'No description, click to add on...' but only the 'No description' part of the sentance is shown to the public - the remainder to the admin when they are logged in....

CR

Administrator
Administrator
acrylian   2008-09-30, 11:00
#10

Sorry, probably I don't get the issue, but what is unclear about "Click to add a description" meaning there is none? If there is no description there is simple nothing shown for not logged in visitors. Why do they need to get a written "No description" if they see that there is none?

Member
Member
CR   2008-09-30, 22:03
#11

The above code works from an end-user point of view - by this I mean that if there is no description then the text 'No description' is shown. However, when I am logged in (as the main Admin) I would have normally have been able to edit my gallery on the fly. However, after the above code changes I can't.

I would like it so that I can click on the 'No description' text and edit it to actually add one instead of having to go into the main admin section, find the image with no description, then add one frm there.

So, to recap - when the above code has been added I cannot use the edit on the fly AJAX functions as I could before (unless a comment is already in place, then I can click it to edit as normal).

I hope you see what I mean...

CR

Administrator
Administrator
acrylian   2008-10-01, 09:59
#12

Ah, I see. Try if (getAlbumDesc() != null) OR zp_loggedin()) { to the if statement.

Member
Member
CR   2008-10-01, 12:52
#13

Hi acrylian, thanks for your fast reply. I have tried what you suggested with: if (getAlbumDesc() != null) OR zp_loggedin()) {. However, I am struggling to use the above code within my template, you see I have `` at the moment.

As you can see, my code either allows me to show the comment (if one exists, as well as edit it using AJAX that is tied into the printImageDesc(true); command) or show 'No description!' (if there isn't a description for that image). However, it does not allow me to click (and edit) this 'No description' text to add my description using AJAX as it has skipped printImageDesc(true); which in turn ties in with the AJAX on-the-fly editing functions...

To get your code working with what I have already do I use something like this:

`

Administrator
Administrator
acrylian   2008-10-01, 16:23
#14

If you want to have "No description added yet" shown within the Ajax edit field you will have to hack the ajax functions and replace our standard message.
Hacking core files is of course not recommend regarding updates.

Here again my example modified:
``

Not really different from the standard way that can be achieve by just using printimagedesc(true)... I still can't follow what the issue with that is.

Member
Member
CR   2008-10-01, 20:33
#15

Hi acrylian, thanks again for your help but the code that you have provided does exactly the same as my original code.. Let me attempt to explan what it is I would like to do as we seem to be getting our wires crossed.

Ok, using printimagedesc(true) as per the default settings within any theme will as I am sure you know, display nothing to my visitors if a comment has not been added. However, if one has then it will be shown. The other thing this command does is allow the main Admin to use the edit-as-you-go AJAX functions to simply click the text Click to add a description... that is only shown while logged in as said Admin.

Now, what I wanted to do was rather than show nothing to my visitors when there is no description; I wanted to show the words, 'No description added yet!' - the code I have does this as follows:

``

This brings us to the point I am at now where I would also still like to be able to use the edit-as-you-go AJAX functions when the above No description added yet! text is being shown but as the code stands at the moment the only time I can use these edit-while-you-browse functions is to edit a comment but not add one.

Other than giving you access to my gallery or you making the code changes yourself I cannot explain things any clearer than that sorry.

Anyway, I really hope you can help me.

Thanks again,

CR

Administrator
Administrator
acrylian   2008-10-02, 08:38
#16

Well, I did get you, but isn't showing no text really obvious to your visitors that there is no description....?

Anyway I gave you the functions to solve that... This should do what you want:

`

`

Member
Member
CR   2008-10-03, 00:56
#17

Hi acrylian, the code that you provided didn't work and just gave errors saying the following:
Parse error: syntax error, unexpected T_STRING, expecting ',' or ';' in C:\*******\Apache2\htdocs\Digital-Photography\themes\Corvus_Corax\image.php on line 107.

Although after having a play with what you did provide I now have it working. I ended up using the following code:

ALBUM.PHP
``

IMAGE.PHP
``

Now when visiting either album.php/image.php when not logged-in I see 'This album does not have a description yet!' and 'This image does not have a description yet!'. However, if a description is already in place then it is shown as expected

Also when logged-in as the main Admin and visiting either album.php/image.php I see:

'Click to add a description...
This album does not have a description yet!'

or

'Click to add a description...
This image does not have a description yet!'

Needless to say, all edit-as-you-go AJAX functions now work as they did but with the added descriptive text just how I wanted it

However, one final thing, it would be fab to be able to have it displayed the other way round or even in-line like so:

'This image does not have a description yet!
Click to add a description...'

'This image does not have a description yet! Click to add a description...'

As before, the 'Click to add a description...' sections are only shown to the main Admin anyway but it would just look cleaner. Any ideas?

Thank you so far,

CR

Member
Member
CR   2008-10-06, 00:55
#18

Well, anyone have any ideas on this last little alteration?

"However, one final thing, it would be fab to be able to have it displayed the other way round or even in-line like so:

'This image does not have a description yet!
Click to add a description...'

'This image does not have a description yet! Click to add a description...'

As before, the 'Click to add a description...' sections are only shown to the main Admin anyway but it would just look cleaner. Any ideas?"

Thanks,

CR

Member
Member
Barbara   2009-01-11, 01:12
#19

I'd like my empty description to stay blank and not saying "no description".
How can I achieve this in the latest version?
I got rid of these lines in template-functions.php

if ( $messageIfEmpty === true ) {
$messageIfEmpty = gettext('(No description...)');
}

but this way the description displays (...) unless I change all of them manually.

Member
Member
sbillard   2009-01-11, 03:55
#20

If it is for normal viewers, the nightly builds will have corrected this after tonight's build.

If you want this for when you are logged in, it would become a problem for the front-end editing capability.

Pages (2): 1 2   
  
Powered By MyBB, © 2002-2026 MyBB Group.
Made with by Curves UI.