Seite 1 von 1

Document rename

Verfasst: Mo 26. Jan 2015, 11:34
von ounos
Hello,

is there any way to rename a wE document using we tags or php code ?

Thank you in advance

Re: Document rename

Verfasst: Mo 26. Jan 2015, 13:39
von mokraemer
currently we don't have a tag for this. if you really need this:

Code: Alles auswählen

<?php
$err=$GLOBALS['we_doc']->we_unpublish();
$GLOBALS['we_doc']->Filename="myNewName';
if(!$err){
$err=$GLOBALS['we_doc']->we_publish();
}
if($err){
echo 'we had a problem during publish, e.g. duplicate filenames';
}
I don't really think you should rename files on the fly, but if you have to, the above code should do the magic.

Re: Document rename

Verfasst: Mo 26. Jan 2015, 13:42
von ounos
Maybe I should be more specific: I need a custom document name when I use <we:write type="document"> tag instead of the default id number. Is there a better solution than the one you provide ?

Thank you very much for the fast response.

Re: Document rename

Verfasst: Mo 26. Jan 2015, 17:25
von mokraemer
jepp, this should be the name Attribute, which I can see is undocumented

Re: Document rename

Verfasst: Mo 26. Jan 2015, 17:52
von e_herrmann
is the name attribute also available for documents? That would be nice!

Re: Document rename

Verfasst: Mo 2. Feb 2015, 16:12
von ounos
mokraemer hat geschrieben:jepp, this should be the name Attribute, which I can see is undocumented
Hm, it seems that 'name' attribute doesn't do anything.

Re: Document rename

Verfasst: Mo 2. Feb 2015, 22:48
von mokraemer
I didn't check that attirbute for rename, but it is in effect on new object's.
@Elko: not now - I just discovered that attribute and it's only used for new created objects. I should give Andreas a hint for the documenation - but maybe it would be a good idea to have a better name for this attribute and maybe we can achieve a rename procedure for this too.

Can one of you post a feature request to the ticket system?

Re: Document rename

Verfasst: Di 3. Feb 2015, 10:35
von ounos
So, for now the only way to rename a document is using the php code from your first post ?
Anyway, thank you so much for your time and I hope the same functionality will be possible for documents also in the future.