when sending a response to a server using xmlwriter, the root tag will always be added to the request:
If I want to post an item:
<book>
<id></id>
<title></title>
<publisher></publisher>
</book>
the actual generated xml is:
<xmlData>
<book>
<id></id>
<title></title>
<publisher></publisher>
</book>
</xmlData>
I can make sure that only one record will be posted: one book for each request
how can I remove the xmlData element? that is to say, make book tag to be the root element
the extjs document says:
Ext.data.writer.Xml
documentRoot : String
The name of the root element of the document. Defaults to 'xmlData'. If there is more than 1 record and the root is not specified, the default document root will still be used to ensure a valid XML document is created.
My understanding is that if there is only one record, the default document root will not be used. Am I right? But acturaly, the root element 'xmlData' is still added even if there is only one record.
Thanks
The Ext.data.writer.Xml class has two configuration properties related to the root element: documentRoot and defaultDocumentRoot. As you noted, the documentation says:
If there is more than 1 record and the root is not specified, the default document root will still be used to ensure a valid XML document is created.
In other words, if documentRoot is null, but more than one record is written, the value of defaultDocumentRoot will be used as the root element. In your case, there is only one record, but documentRoot is not null, as its default value is "xmlData".
To omit the root element for single records, then, you need to explicitly set documentRoot to null:
new Ext.data.writer.Xml({ documentRoot: null });
Related
I have an app in folder /var/www/test
Also there is an "sub-app" in folder /var/www/test/subapp (There is another index.php inside
If user will type test.com the index.php of test should trigger but when user type test.com/triggersubapp the index,php from /var/www/test/subapp shall run.
I failed to create correct statements and RewriteRules and I haven't got much time left. So have any one of You know how to do this easiest way or maybe have a correct definition?
I would greatly appreciate it !!!
EDIT
The main index.php and .htaccess are in /var/www/test/public/. :(
Put this in your .htaccess in root directory:
RewriteEngine On
RewriteRule ^triggersubapp/?$ subapp/index.php
This will rewrite triggersubapp to subapp/index.php which means if user enters test.com/triggersubapp he/she will see result for test.com/subapp/index.php
This question is similar to this other one, but I am using full-URL, no mod_rewrite, see cakephp WITHOUT mod_rewrite or this "sibling question".
I have a CakePHP folder that works well, at /var/www/mycake (localhost/mycake). Now I need change to /var/www/test/mycake (localhost/test/mycake)... HOW TO DO THIS CHANGE with minimal PHP code changes?
I add a controller as Cake message recomended:
TestMyCakeController.php ... nothing
TestController.php OK (!), but other error arrises
Cake defines its ROOT directory in the root index.php file. If you look inside you'll see the following lines:
define('ROOT', dirname(__FILE__));
define('WEBROOT_DIR', 'mycake');
define('WWW_ROOT', ROOT . '/' . 'test' . '/'. WEBROOT_DIR . '/');
You can easily move a CakePHP application to another directory under your web root. The top level index.php contains the line:
define('ROOT', dirname(__FILE__));
This will set the root directory to the current location of the main index.
I have a question about vhost_alias
I got it working, it does the following job:
vhost.subdomain.domain.com -> sends to /var/www/vhost
using virtualdocumentroot and %1
But I don't like that I can access the same content also like this
vhost.vhost.subdomain.domain.com
since I have ServerAlias to *.subdomain.domain.com
How can I force that only vhost.subdomain.domain.com works?
The aim is to have many vhosts like this, for exmaple vhost1, vhost2, etc.
Thanks,
David
One solution you could try is to add a fixed subdomain in your ServerAlias, before your actual dynamic subdomain:
Example:
ServerAlias www.*.subdomain.domain.com
This will ensure that
vhost.vhost.subdomain.domain.com
does not redirect, however, you will be forced to always add www. before your name.
I am completely new to CakePHP and installed 2.1. I am getting this error:
Missing Controller
Error: Index.phpController could not be found.
Error: Create the class Index.phpController below in file: app\Controller\Index.phpController.php
<?php
class Index.phpController extends AppController {
}
Notice: If you want to customize this error message, create app\View\Errors\missing_controller.ctp
Stack Trace
APP\webroot\index.php line 96 → Dispatcher->dispatch(CakeRequest, CakeResponse)
ROOT\index.php line 40 → require(string)
I followed their guide at http://book.cakephp.org/2.0/en/installation/advanced-installation.html and tried everything it stated:
I enabled mod_rewrites (they were already enabled from something else)
I have all the .htaccess files in the directories
I have cake installed under my document root so I access it at localhost/cakephp/index.php
I do not know where to proceed from here. Thanks for any help you can give me.
Update: I just re-read your question and realized you're loading http://localhost/cakephp/index.php. Don't do that. Since you appended "index.php", it is trying to load a controller called "index.php" and the action "index" for that controller. Resulting mapped path to the "index.php controller" is app\Controller\Index.phpController.php.
Since you have the rewrites enabled, browse to http://localhost/cakephp without appending any filename.
Original answer:
Assuming you're using Apache, double-check the .htaccess in your /app/webroot directory. It should include the following:
RewriteRule ^(.*)$ index.php?/$1 [QSA,L]
Based on your error, it doesn't look like it's properly appending the path after your index.php file.
If you are using cakephp 2.0 or greater than rename the controller file name as the class name.
ie TaskController.php
class TasksController extends AppController {
--Your code inside class
}
I hope this will help you
the easiest solution is to stick to the "live environment" as close as possible.
this means using vhosts to use a "domain" and correctly root down to your webroot dir:
http://www.dereuromark.de/2011/05/29/working-with-domains-locally/
this leaves almost no room for error and also helps with other potential problems like "absolutely linked asset files" etc
I'm adding some attributes from live to staging for testing purposes, I'm using ldifde:
D:\Shared>ldifde -i -v -f attr3.ldf -j .
Connecting to "myDomain.com"
Logging in as current user using SSPI
Importing directory from file "attr3.ldf"
Loading entries
1: CN=myAttribute,CN=Schema,CN=Configuration,DC=myDomain,DC=com
Entry modified successfully.
1 entry modified successfully.
The command has completed successfully
D:\Shared>
But when I try to update it using vbs, I got:
C:\Users\update.vbs(8, 1) Active Directory: The requested operation did not
satisfy one or more constraints associated with the class of the object.
Please notice that other attributes, the original ones, are able to be updated, this issue is only for the ones I'm importing.
So, I wonder if I'm missing some step like link or detach the new attribute after imported.
This is attr3.ldf
#attr3.ldf
#adding my new attribute
dn: CN=myAttribute,CN=Schema,CN=Configuration,DC=myDomain,DC=com
changetype: add
objectClass: top
objectClass: attributeSchema
cn: my-Attribute
distinguishedName: CN=my-Attribute,CN=Schema,CN=Configuration,DC=myDomain,DC=com
instanceType: 4
whenCreated: 20100401175340.0Z
whenChanged: 20100401175341.0Z
uSNCreated: 24154
attributeID: 2.16.840.1.113805.111
attributeSyntax: 2.5.5.12
isSingleValued: TRUE
rangeLower: 0
rangeUpper: 1
uSNChanged: 24163
showInAdvancedViewOnly: TRUE
adminDisplayName: my-Attribute
adminDescription: my-Attribute
oMSyntax: 64
searchFlags: 0
lDAPDisplayName: myAttribute
name: my-Attribute
schemaIDGUID:: tonVW6suWUu1Gev/D1pI9Q==
isMemberOfPartialAttributeSet: TRUE
objectCategory: CN=Attribute-Schema,CN=Schema,CN=Configuration,DC=myDomain,DC=com
#The following attributes were removed because I was getting:
#Add error on entry starting on line 1: Unwilling To Perform
#The server side error is: 0x20e7 The modification was not permitted for security
#reasons.
#The extended server error is:
#000020E7: SvcErr: DSID-03152D2C, problem 5003 (WILL_NOT_PERFORM), data 0
#objectGUID:: eTKYtnXbCE2fPMgc8UIe0w==
#attributeSecurityGUID:: VAGN5Pi80RGHAgDAT7lgUA==
And this is the vbs code,
'update.vbs
Set objUser = GetObject("LDAP://CN=John Lennon,CN=Users,DC=myDomain,DC=com")
objUser.myAttribute="someValue" 'Also tried with integers but not luck
objUser.SetInfo
Thanks,
m0dest0.
Thank you JPBlanc, you are right, I was missing to add the attr to the class and then refresh the schema,
Register the dll, regsvr32 schmmgmt.dll
Open Run and type mmc.exe
Add Active directory schema snap-in
Right click on the class, properties and hit the Add button and so on.
Finally, refresh the schema:
C:\Users>admod -sc refreshschema
AdMod V01.17.00cpp Joe Richards (joe#joeware.net) March 2011
Modifying ROOTDSE...
DN Count: 1
Using server: myServer.myDomain.com:389
Directory: Windows Server 2008 R2
Modifying specified objects...
DN: ROOTDSE...
The command completed successfully
Regards,
Adding an attribute to the Schema is not enought, you must also add the attribute to the user class (in the schma) if you want to use it in a user object. You must modify your LDIF file:
# Define your attribute
# Reload the schema
dn:
changetype: modify
add: schemaUpdateNow
schemaUpdateNow: 1
-
# modify user class
Have a look to your Schema using Microsoft MMC (registering schmmgmt.dll)
If you still have trouble, I can help again tomorow morning.