Welcome Guest, Not a member yet? Register   Sign In
  Detect Function In Controller
Posted by: El Forum - 06-05-2008, 08:00 AM - Replies (6)

[eluser]gedev2006[/eluser]
Hi

I have a class for example with a constructor. The construct function detects if a user is logged in or not before allowing access to any functions.

What I want is to be able for the constructor to detect which function the user is trying to access to allow specific functions to be used regardless of the logged in state. This can be done in each function that needs a login, but there are allot of functions and would rather have 1 check only

Thanks


  URL Helper Extended - anchor_img() added [moved]
Posted by: El Forum - 06-05-2008, 07:59 AM - No Replies

[eluser]Isern Palaus[/eluser]
http://ellislab.com/forums/viewthread/81770/

This needs to be to "Ignited Code", I think that fits more than this sub-forum.


  The PHP Benchmark - (news)
Posted by: El Forum - 06-05-2008, 07:24 AM - Replies (1)

[eluser]Tony Nash[/eluser]
I found this link today!

http://www.phpbench.com/

I think it is worth for all PHP developers. Smile


  Looking for Solution of CI config
Posted by: El Forum - 06-05-2008, 07:06 AM - Replies (1)

[eluser]vps4[/eluser]
usually, we put config setting in the database
but CI's config file loaded earlier than database library
now , the problem is : config must get through database library

my Solution is :
write a Model
but I think it's not good.

for example: some code in my Model

Code:
$query = $this->db->get('setting');

and add it to CI config

Code:
$this->config->set_item('setting', $this->setting);

and in the Controller

Code:
$something = $this->config->item('something', 'setting')

I almost collapsed, It make the simple things complicated
Although I have written to solve this problem

Is anybody have a good idea?


  HTML Helper Extended - script_tag() added [moved]
Posted by: El Forum - 06-05-2008, 06:44 AM - No Replies

[eluser]Isern Palaus[/eluser]
http://ellislab.com/forums/viewthread/81771/

This needs to be to "Ignited Code", I think that fits more than this sub-forum.


  MY_Model Database Abstraction Library -> Usefull or Useless ???
Posted by: El Forum - 06-05-2008, 04:36 AM - Replies (1)

[eluser]Unknown[/eluser]
Hello Everybody,

I would like to receive a feedback about a basic idea I have, that is related to the Model part of the MVC approach that I learned through the use of CI. The idea is as follows :

One recursive problem I find when I develop a brand new web application is the database layout that must match with its corresponding models. When I change something in a table, I have to modify my model as well.

Indeed I know that a good project planning involves creating the database model BEFORE coding it ^^ but because I don't have the basic knowledge of application pre-development, I just code my app "on the fly" and need to modify both database and model everytime.

My question is as follows :

Do you think it could be usefull to have a model that adapts the database to itself instead of having to adapt the model to the database structure. In other words, do you see an interest in having a few privates methods within a model that makes this model modify the database "on the fly".

For example let's say I want to create a Car Model, I would have to create let's say a Brand property, a Color property and a Model property. Once my model is finished, it could check to see if it can find the 'cars' table with only (and not more) three columns called 'Brand', 'Color' and 'Model', PLUS an "id" column and that's all. At this point a few possibilities arise :

1 - The table does not exists and the Model loads a particular method to create the table.
2 - The table exists but its structure does not match the exact structure of the model, then the models modify the structure without removing any table rows but only adapting the table structure to its own structure.
3 - The table exists and its structure match the structure of the model, everything's all right.

In this case, if I need to add a new column into my table, let's say 'Engine', I just have to declare a new property called 'Engine' with a default value of "Default" and the model will by itself update the table and its rows by adding a new column "Engine" and set all the existing rows with a "Default" value within the brand new "Engine" column.

Now and to finish, first of all pardon me for my french-like english ^^
And second : Can this concept be usefull or useless ? Maybe is there already another existing solution ? Or maybe there's no need to think this way : CI can already do that for you (maybe use some of the scaffolding functions within the model) ! Or maybe: this is a stupid idea, here's why: ... !

Whatever you think about this idea, please post your feelings ^^

Sincerely Yours ...


  variables persisting across multiple view loads
Posted by: El Forum - 06-05-2008, 02:39 AM - Replies (9)

[eluser]yelirekim[/eluser]
I'm not really sure whether this is a 'bug', but from a usability standpoint I think it would make sense for things to function as I'm about to describe.

Currently the variables that are extracted for use within views will persist across multiple calls to the load->view() function, if you use many views, and each view has similar page elements on it, it's difficult to keep all of the variable names straight and make sure you don't reuse them. For example:

Index function within Controller:

Code:
function index()
{
    $data['print'] = true;
    $data['content'] = "content";
    $this->load->view('debug',$data);
    $other_data['content'] = "other content";
    $this->load->view('debug',$other_data);
}

Debug View file:
Code:
<p>&lt;?php
    if(isset($print))
        print_r($content);
?&gt;</p>

Browser output:

Quote:content

other content

Expected output:
Quote:content

I know this seems trivial from the example, but in my case I have a 'Pagebuilder' library which loads in many views (header, navigation, content, footer) however one of the views and its associated data is specified outside of the library, as seen in the following example:

Code:
function index()
{
    $this->load->model('blog');
    $entries = $this->blog->get_entry_items(10);
    $data['content'] = $entries;
    //this function loads many other views besides the 'blog' view specified
    $this->pagebuilder->build('blog',$data);
}

I ran into a problem earlier where I had collisions with the names of the variables passed to the views. It's a problem that's easily solved by keeping track of all the variable names used within the views, but things working like this breaks the encapsulation of my Pagebuilder class. Ideally each of the variables passed to a view would be unset (or through some other method made inaccessible to other views) after that view is finished loading.

Anyone think this qualifies as a bug?


  Multi-User File Management with CodeIgniter?
Posted by: El Forum - 06-05-2008, 02:31 AM - Replies (3)

[eluser]Unknown[/eluser]
Hi Folks,

I'd like to hear some opinions of some experienced CI users.
I have to develop a file up-/downloading system with the following requirements:

- admin can add clients, projects and possibly subprojects (multiple projects for 1 client)
- clients can log in and see/download files that were uploaded for them (by
admin)
- clients can upload files into an selectable project (project must be assigned to customer, of course)
- clients and admin can write comments on uploaded files
- client gets notified by e-mail when admin uploads new file/writes new comment
- admin gets notified by e-mail when client uploads new file/writes new comment

I've already done a little, less complex, file uploading script in CodeIgniter using freak_auth for authentication and was quite satisfied with it. Just haven't really used models yet, that was rather dirty, I guess.

Now, I got attracted by cakePHP for it's built-in authentication. The documentation of cake seems bad compared to CI, though. Also Cake doesn't have a built-in upload helper class.

CakePHP on the other side doesn't seem to offer any helpers for file
uploads, which CI does.

I know, it's kinda stupid to ask inside the CI forums if you'd prefer some other framework over CI. I'd be just glad if someone would convince me, CI is the tool of the trade to get this thing well done Wink


Talking 'bout freak_auth: Is this great class still being activly developed? It's been a while since the last time it got updated, so I'm just wondering...

Regards,
Daniel


  Digital products and credit card theft
Posted by: El Forum - 06-05-2008, 02:05 AM - Replies (4)

[eluser]johnwbaxter[/eluser]
I have a shop that sells digital goods. You pay your money, you can download your product instantly.

Trouble is, i have recently had a few people buy who have used cloned / stolen credit cards. The credit card is accepted by the payment processor and tells my shop that all is well, so the shop releases access to the product.

A few hours later the person who's credit card it is notifies the payment processor that the transaction was fraudulent and i refund their money, but obviously someone else has got my product that i can't get back or trace who has it.

I'm wondering if i should put a 10 (or more) hour delay between people paying and actually delivering their product. This would be a shame as i would like it to be available to the purchaser as soon as they have paid.

Does anyone have any experience of this or any advice they could slip my way?


  I have integrated a new version CI based on CI 1.6.1.
Posted by: El Forum - 06-04-2008, 11:42 PM - Replies (5)

[eluser]chmod[/eluser]
I use the following plugins:
1:adodb 5 (which can connect more than one database ,though the db type is different.)
2:fckeditor 2.6 (which can allow you create a editor,strong and easy...)
4:enable $_GET (because CI disable $_GET,but when you get data from another website which use get...,now you can GET...)
5:Smarty 2.6 (option)
...
Is it useful ?


Welcome, Guest
You have to register before you can post on our site.

Username
  

Password
  





Latest Threads
Error / Shield 1.0.3 + Ci...
by kenjis
2 hours ago
Integrating Bootstrap 5 i...
by tarcisiodev1
3 hours ago
Asset Minification Packag...
by tarcisiodev1
3 hours ago
Modify users data as an a...
by luckmoshy
3 hours ago
Is it possible to go back...
by ejimenezo
9 hours ago
SQL server connection not...
by davis.lasis
Today, 07:11 AM
Validation | trim causes ...
by Gary
Today, 05:09 AM
Problem with session hand...
by Julesb
Today, 04:13 AM
External script access to...
by PomaryLinea
Today, 03:58 AM
VIRUS reported after Chro...
by InsiteFX
Yesterday, 11:34 PM

Forum Statistics
» Members: 85,497
» Latest member: okkubetcom
» Forum threads: 77,586
» Forum posts: 376,025

Full Statistics

Search Forums

(Advanced Search)


Theme © iAndrew 2016 - Forum software by © MyBB