we_save() and filepath Beitrag ist gelöst

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

we_save() and filepath

Beitragvon ounos » Do 31. Mär 2016, 12:15

I am trying to create a new document under a custom folder (i.e. my_path) using the following code:

Code: Alles auswählen

$doc = new we_webEditionDocument();
$doc->Filename = $doc_id;
$doc->Path = "/my_path/" . $doc_id . ".php";
$doc->Extension = ".php";
$doc->we_save();


but the document is created under root folder, although when I browse it, it points to http://example.com/my_path/my_doc.php.
Any ideas ?

Benutzeravatar
biwaMedia
webEdition Partner
webEdition Partner
Beiträge: 557
Registriert: Mo 15. Dez 2003, 16:00
Kontaktdaten:

Re: we_save() and filepath

Beitragvon biwaMedia » Do 31. Mär 2016, 12:38

Hi,

try to look at an existing document by

Code: Alles auswählen

$doc = new we_webEditionDocument();
$doc->initById('yourId')
p_r($doc);


There you can find the values you have to set, like perhaps $doc->ParentID, $doc->IsSearchable and so on...

Bye
Timo
webEdition Partner - http://www.blickfang-media.com
Vorstand im webEdition e.V. (Kassenwart)

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

Re: we_save() and filepath  Beitrag ist gelöst

Beitragvon ounos » Do 31. Mär 2016, 13:37

biwaMedia hat geschrieben:Hi,

try to look at an existing document by

Code: Alles auswählen

$doc = new we_webEditionDocument();
$doc->initById('yourId')
p_r($doc);


There you can find the values you have to set, like perhaps $doc->ParentID, $doc->IsSearchable and so on...

Bye
Timo

Thanks for the advice.
JFTR: setting the ParentID did the trick.

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

Re: we_save() and filepath

Beitragvon mokraemer » Do 31. Mär 2016, 13:51

make sure it is really necessary you do this by plain php. It is really not recommended to use these functions/classes. In most cases there is a safe construct via our tag-api.
webEdition-Kern-Entwickler

WBTMagnum
webEdition Partner
webEdition Partner
Beiträge: 1318
Registriert: Di 7. Mär 2006, 16:50
Kontaktdaten:

Re: we_save() and filepath

Beitragvon WBTMagnum » Do 31. Mär 2016, 14:50

Thanks for the advise Marc. But since we are pulling several thousand documents from another page for a relaunch, we-Tags are not really applicable.

Cheers,
Sascha

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

Re: we_save() and filepath

Beitragvon mokraemer » Do 31. Mär 2016, 23:22

ok, if this is only for "converting" some documents I don't see any problems. Adjust the statements to your needs.
Since we use the code in combination with js (our backend), some things are set via js/http-post, so you can't rely to 100% the called function sets all needed fields acordingly. As stated by Timo, check the settings of an existing document or compare the result to your basic settings, to see the difference.

For your concrete question "Path" is only informal for search - set the parentID, the path is created on save from this.
webEdition-Kern-Entwickler


Zurück zu „webEdition Basic Version“

Wer ist online?

Mitglieder in diesem Forum: 0 Mitglieder und 1 Gast