Here's how I suggest solving the problem:

{{#if: {{#ask:[[Category:Images]] [[Belongs to::{{PAGENAME}}]] [[Main::Yes]]
[[Image of::Portrait]]|?}}
                | {{#ask:[[Category:Images]] [[Belongs to::{{PAGENAME}}]] 
[[Main::Yes]]
[[Image of::Portrait]]|?}}
                | {{#formlink: form=Image upload
                                | link text = No main image available
                                | query string = Image[Belongs
to]={{PAGENAME}}&Image[Main]=Yes&Image[Image of]=Portrait
                        }}
        }}

I'm guessing your problem is that you don't always know what the file name
will be, which is required to use #ifexist. In that bit of code above, it
will look for an image in the images category that "Belongs to" your
author's page. Since you could have many images of the author, such as
photos when they were a child, or with groups of other people, you can
designate one of them to have a "Main" image property. You can also search
for one that has a "Portrait" property, for some consistency in how they
appear in their main photo.

That gives you the flexibility to have many different types of photos, each
with perhaps one that can stand as a representative "Main" photo.

If no image is found, it will instead display "No image available", and the
text will be a link to a custom upload form where you can have uploaders
indicate what type of image it is, so all this can work automatically.

If you need a simpler example, just ask, and I'll trim out all those extra
features so you can try out just the bare basics.




asafbareket wrote:
> 
> Hi all, 
> 
> I have a very large wiki site for literature. I want to upload a photo for
> each author on the site, but I don't have all the photos. So I thought I
> can upload the images that I have, and the authors that don't have a photo
> will get the default image "No photo Available". 
> 
> So I guess I should use the parser #ifexist for that, and tried all kinds
> of syntax, but none worked. 
> 
> can anyone help please?
> 
> Thank you, 
> Asaf 
> 
> 
> MediaWiki 1.16.4 
> PHP 5.2.17 (cgi-fcgi) 
> MySQL 5.1.53-log 
> 
> 

-- 
View this message in context: 
http://old.nabble.com/Using--ifexist-with-images-tp32503791p32503847.html
Sent from the Semantic Mediawiki - Development mailing list archive at 
Nabble.com.


------------------------------------------------------------------------------
All the data continuously generated in your IT infrastructure contains a
definitive record of customers, application performance, security
threats, fraudulent activity and more. Splunk takes this data and makes
sense of it. Business sense. IT sense. Common sense.
http://p.sf.net/sfu/splunk-d2dcopy1
_______________________________________________
Semediawiki-devel mailing list
Semediawiki-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/semediawiki-devel

Reply via email to