Document rename

Benutzeravatar
ounos
Member
Beiträge: 44
Registriert: Mi 6. Aug 2014, 11:09

Document rename

Beitragvon ounos » Mo 26. Jan 2015, 11:34

Hello,

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

Thank you in advance

mokraemer
Senior Member
Beiträge: 3619
Registriert: So 8. Aug 2010, 01:23
Wohnort: Mainz

Re: Document rename

Beitragvon mokraemer » Mo 26. Jan 2015, 13:39

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.
webEdition-Kern-Entwickler

Benutzeravatar
ounos
Member
Beiträge: 44
Registriert: Mi 6. Aug 2014, 11:09

Re: Document rename

Beitragvon ounos » Mo 26. Jan 2015, 13:42

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.

mokraemer
Senior Member
Beiträge: 3619
Registriert: So 8. Aug 2010, 01:23
Wohnort: Mainz

Re: Document rename

Beitragvon mokraemer » Mo 26. Jan 2015, 17:25

jepp, this should be the name Attribute, which I can see is undocumented
webEdition-Kern-Entwickler

e_herrmann
Senior Member
Beiträge: 1319
Registriert: Do 22. Mai 2003, 23:25

Re: Document rename

Beitragvon e_herrmann » Mo 26. Jan 2015, 17:52

is the name attribute also available for documents? That would be nice!
Elko Herrmann
komplexx | internet.fotografie
web: http://www.komplexx.de

Benutzeravatar
ounos
Member
Beiträge: 44
Registriert: Mi 6. Aug 2014, 11:09

Re: Document rename

Beitragvon ounos » Mo 2. Feb 2015, 16:12

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.

mokraemer
Senior Member
Beiträge: 3619
Registriert: So 8. Aug 2010, 01:23
Wohnort: Mainz

Re: Document rename

Beitragvon mokraemer » Mo 2. Feb 2015, 22:48

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?
webEdition-Kern-Entwickler

Benutzeravatar
ounos
Member
Beiträge: 44
Registriert: Mi 6. Aug 2014, 11:09

Re: Document rename

Beitragvon ounos » Di 3. Feb 2015, 10:35

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.


Zurück zu „webEdition Basic Version“

Wer ist online?

Mitglieder in diesem Forum: 0 Mitglieder und 6 Gäste