Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

getChildrenByTag, getChildrenByID, getChildrenByClass, etc doesnt work #21

Closed
GoogleCodeExporter opened this issue Mar 19, 2015 · 1 comment

Comments

@GoogleCodeExporter
Copy link

Hi

These functions in ganon.php:

    function getChildrenByID($id, $recursive = true) {
        return getChildrenByAttribute('id', $id, 'equals', 'total', $recursive);
    }
    function getChildrenByClass($class, $recursive = true) {
        return getChildrenByAttribute('class', $id, 'equals', 'total', $recursive);
    }
    function getChildrenByName($name, $recursive = true) {
        return getChildrenByAttribute('name', $name, 'equals', 'total', $recursive);
    }

returns an error, because the call ( getChildrenByAttribute ) is not in the 
scope
of the class.

You must make the call as:

    function getChildrenByID($id, $recursive = true) {
        return $this->getChildrenByAttribute('id', $id, 'equals', 'total', $recursive);
    }
    function getChildrenByClass($class, $recursive = true) {
        return $this->getChildrenByAttribute('class', $id, 'equals', 'total', $recursive);
    }
    function getChildrenByName($name, $recursive = true) {
        return $this->getChildrenByAttribute('name', $name, 'equals', 'total', $recursive);
    }   

in order to work...

or... you can put off that function_create invention and do a normal select 
instead:

    function getChildrenByAttribute($attribute, $value, $mode = 'equals', $compare = 'total', $recursive = true) {
        return $this->select( sprintf('[%s="%s"]',$attribute,$value) );
    }
    function getChildrenByTag($tag, $compare = 'total', $recursive = true) {
    return $this->select( $tag );
    }
    function getChildrenByID($id, $recursive = true) {
        return $this->select( sprintf('[id="%s"]',$class) );
    }
    function getChildrenByClass($class, $recursive = true) {
    return $this->select( sprintf('[class="%s"]',$class) );
    }
    function getChildrenByName($name, $recursive = true) {
        return $this->select( sprintf('[name="%s"]',$class) );
    }



Original issue reported on code.google.com by Radika...@gmail.com on 20 Sep 2012 at 11:37

@GoogleCodeExporter
Copy link
Author

Sorry it took so long, but thanks for reporting!

Original comment by niels....@gmail.com on 19 Oct 2012 at 5:28

  • Changed state: Fixed
  • Added labels: Priority-High
  • Removed labels: Priority-Medium

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant