EzDevInfo.com

phreeze

Phreeze Framework for PHP Phreeze | A PHP5 MVC+ORM Framework and Application Generator phreeze | a php5 mvc+orm framework and application generator

Phreeze Nginx rewrite issue

I am trying to get Phreeze to install on my server - everything is on the server but the problem is after I add the following rewrite rule for nginx:

location ~ ^/phreeze/builder/(.*) {
    try_files /phreeze/builder/$1 /phreeze/builder/$1/ /phreeze/builder/index.php?_REWRITE_COMMAND=$1&args;
}

All my server does is prompt me to download the actual file. What could be causing this issue?

I'm following this documentation: http://phreeze.com/phreeze/documentation/installation.php

In the file, i'm using their nginx rewrite rules as shown in full below:

# PHREEZE CONF FILE FOR NGNIX 
#
# This is a partial example conf file to demonstrate how to configure
# URL rewriting in ngnix for Phreeze applications.  This example assumes
# that you are forwarding php requests to php-fpm via port 9000.
# you should be able to update the php location block without affecting
# the Phreeze location blocks
#
# Do not replace your entire ngnix.conf file with this, rather select the relevant
# location blocks.  PLEASE NOTE that the Phreeze application location blocks
# must appear *after* the ~ \.php$ location block, otherwise you will see server
# errors due to an infinite redirection loop

server {
    listen       8080;
    server_name  localhost;
    root   /path/to/htdocs;
    index  index.php index.html index.htm;

    # pass the PHP scripts to FastCGI server listening on 127.0.0.1:9000
    #
    # NOTE: change "fastcgi_pass" to the correct port or socket as necessary 
    # based on your php-fpm configuration (ex. /tmp/php-fpm.sock)
    #
    location ~ \.php$ {
        include fastcgi.conf;
        fastcgi_intercept_errors on;
        fastcgi_pass 127.0.0.1:9000;
        fastcgi_index index.php;
    }

    # url rewriting for the phreeze builder application
    #
    location ~ ^/phreeze/builder/(.*) {
        try_files /phreeze/builder/$1 /phreeze/builder/$1/ /phreeze/builder/index.php?_REWRITE_COMMAND=$1&args;
    }

    # url rewriting for a Phreeze application called "example" 
    #
    location ~ ^/example/(.*) {
        try_files /example/$1 /example/$1/ /example/index.php?_REWRITE_COMMAND=$1&args;
    }

    # url rewriting for phreeze app that is installed in the htdocs root
    #
    #location ~ ^/(.*) {
    #    try_files /$1 /$1/ /index.php?_REWRITE_COMMAND=$1&args;
    #}

    # this is an alternate method of rewriting.  this method is discouraged
    # in the ngnix documentation for performance reasons, however it may be
    # helpful or necessary in some situations.  it's here for reference purposes only
    #
    #location ~ ^/example2/(.*) {
    #    if (!-e $request_filename){
    #        rewrite  ^/example2/(.*)$  /example2/index.php?_REWRITE_COMMAND=$1?  last;
    #    }
    #}
}

Any ideas?

Thanks!


Source: (StackOverflow)

filter a new customfield Phreeze

I am using Phreeze to create an application. Everything goes right but when I want to filter in a template a custom field (tagtypeName) it doesn't do it.

I have the model in model.js:

model.TagModel = Backbone.Model.extend({
    urlRoot: 'api/tag',
    idAttribute: 'id',
    id: '',
    name: '',
    type: '',
    TagtypeName: '',
    baja: '',
    defaults: {
        'id': null,
        'name': '',
        'type': '',
        'baja': ''
    }
});

My criteria is TagCriteria.php:

public function GetFieldFromProp($propname)
    {
        switch($propname)
        {
            case 'TagtypeName':
                return 'tagtype.id';
            case 'Id':
                return 'tag.id';    
            case 'Name':
                return 'tag.name';
            case 'Type':
                return 'tag.type';
            case 'Baja':
                return 'tag.baja';  
            default:
                return parent::GetFieldFromProp($propname);
                //throw new Exception('Unable to locate the database column for the property: ' . $propname);
        }
    }

My reporter is: public $Id; public $Name; public $Type; public $Baja; public $TagtypeName;

/*
* GetCustomQuery returns a fully formed SQL statement.  The result columns
* must match with the properties of this reporter object.
*
* @see Reporter::GetCustomQuery
* @param Criteria $criteria
* @return string SQL statement
*/
static function GetCustomQuery($criteria)
{
    $sql = "select
        `tagtype`.`name` as TagtypeName
        ,`tag`.`id` as Id
        ,`tag`.`name` as Name
        ,`tag`.`type` as Type
        ,`tag`.`baja` as Baja
    from `tag`
    inner join `tagtype` on `tagtype`.`id`=`tag`.`type`";

    // the criteria can be used or you can write your own custom logic.
    // be sure to escape any user input with $criteria->Escape()
    $sql .= $criteria->GetWhere();
    $sql .= $criteria->GetOrder();

    return $sql;
}

the view has:

        <script type="text/template" id="tagCollectionTemplate">
            <table class="collection table table-bordered table-hover">
            <thead>
                <tr>
                    <th id="header_Id">Id<% if (page.orderBy == 'Id') { %> <i class='icon-arrow-<%= page.orderDesc ? 'up' : 'down' %>' /><% } %></th>
                    <th id="header_Name">Name<% if (page.orderBy == 'Name') { %> <i class='icon-arrow-<%= page.orderDesc ? 'up' : 'down' %>' /><% } %></th>
                    <!--<th id="header_Type">Type<% if (page.orderBy == 'Type') { %> <i class='icon-arrow-<%= page.orderDesc ? 'up' : 'down' %>' /><% } %></th>-->
                    <th id="header_Type">Type<% if (page.orderBy == 'TagtypeName') { %> <i class='icon-arrow-<%= page.orderDesc ? 'up' : 'down' %>' /><% } %></th>
                    <th id="header_Baja">Baja<% if (page.orderBy == 'Baja') { %> <i class='icon-arrow-<%= page.orderDesc ? 'up' : 'down' %>' /><% } %></th>
                </tr>
            </thead>
            <tbody>
            <% items.each(function(item) { %>
                <tr id="<%= _.escape(item.get('id')) %>">
                    <td><%= _.escape(item.get('id') || '') %></td>
                    <td><%= _.escape(item.get('name') || '') %></td>
                    <!--<td><%= _.escape(item.get('type') || '') %></td>-->
                    <td><%= _.escape(item.get('tagtypeName') || '') %></td>
                    <td><%= _.escape(item.get('baja') || '') %></td>
                </tr>
            <% }); %>
            </tbody>
            </table>

            <%=  view.getPaginationHtml(page) %>
        </script>

and in my controller I've changed the Tag to my reporter:

$tags = $this->Phreezer->Query('TagReporter',$criteria)->GetDataPage($page, $pagesize);

So when I go to the page I see the table instead of with the type id, it has the name of the type from my custome query as needed enter image description here

but when I filter, no data is found with the new custom field: enter image description here

Does anyone know how to handle this problem?


Source: (StackOverflow)

Advertisements