![]() |
|
Simple "No description" if no description exists? - Printable Version +- ZenphotoCMS Forum (https://forum.zenphoto.org) +-- Forum: Support (https://forum.zenphoto.org/forum-1.html) +--- Forum: General support (https://forum.zenphoto.org/forum-4.html) +--- Thread: Simple "No description" if no description exists? (/thread-770.html) Pages:
1
2
|
Simple "No description" if no description exists? - Jan - 2006-08-29 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? Simple "No description" if no description exists? - barista - 2007-01-08 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. Simple "No description" if no description exists? - trisweb - 2007-01-15 It's better to do this in the theme: 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. Simple "No description" if no description exists? - Jan - 2007-01-20 Thanks for replying! I did it like this, and it seems to be working pretty good: `` Have a nice weekend. Simple "No description" if no description exists? - trisweb - 2007-01-21 Perfect, that's how I'd do it. Thanks for replying Simple "No description" if no description exists? - fiction - 2008-06-19 To only show the description if it exists: ` ` (for image descriptions, swap Simple "No description" if no description exists? - CR - 2008-09-29 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 Simple "No description" if no description exists? - sbillard - 2008-09-30 That is because when you do not call the A better solution to your problem would be to use phpMyAdmin to insert 'No Description' into any record which currently has an empty description. Simple "No description" if no description exists? - CR - 2008-09-30 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 Simple "No description" if no description exists? - acrylian - 2008-09-30 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? Simple "No description" if no description exists? - CR - 2008-09-30 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 Simple "No description" if no description exists? - acrylian - 2008-10-01 Ah, I see. Try Simple "No description" if no description exists? - CR - 2008-10-01 Hi acrylian, thanks for your fast reply. I have tried what you suggested with: 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 To get your code working with what I have already do I use something like this: ` Simple "No description" if no description exists? - acrylian - 2008-10-01 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. Here again my example modified: Not really different from the standard way that can be achieve by just using Simple "No description" if no description exists? - CR - 2008-10-01 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 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 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 Simple "No description" if no description exists? - acrylian - 2008-10-02 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: ` ` Simple "No description" if no description exists? - CR - 2008-10-03 Hi acrylian, the code that you provided didn't work and just gave errors saying the following: 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 Also when logged-in as the main Admin and visiting either 'Click to add a description... or 'Click to add a description... 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! '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 Simple "No description" if no description exists? - CR - 2008-10-06 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! '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 Simple "No description" if no description exists? - Barbara - 2009-01-11 I'd like my empty description to stay blank and not saying "no description". if ( $messageIfEmpty === true ) { but this way the description displays (...) unless I change all of them manually. Simple "No description" if no description exists? - sbillard - 2009-01-11 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. |