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

Username/Email:
  

Password
  





Search Forums

(Advanced Search)

Forum Statistics
» Members: 10,156
» Latest member: filipirie
» Forum threads: 67,060
» Forum posts: 419,846

Full Statistics

Latest Threads
Chrome >= 63 and virtual...
Forum: Lounge
4 hours ago
» Replies: 1   » Views: 36
Underscores in apache vir...
Forum: Lounge
9 hours ago
» Replies: 2   » Views: 70
Adding Specific Configura...
Forum: General Help
Today, 06:09 AM
» Replies: 2   » Views: 64
How to gracefully degrade...
Forum: General Help
Today, 06:04 AM
» Replies: 1   » Views: 52
Codeigniter & Imap Librar...
Forum: Addins
Today, 04:18 AM
» Replies: 0   » Views: 58
Make table with two recor...
Forum: General Help
Today, 02:53 AM
» Replies: 3   » Views: 93
Community auth problems
Forum: Addins
Today, 12:47 AM
» Replies: 1   » Views: 68
How to show category name...
Forum: General Help
Today, 12:11 AM
» Replies: 0   » Views: 40
Do a second library load
Forum: Libraries & Helpers
Yesterday, 06:29 PM
» Replies: 1   » Views: 68
[split] Houston I have a ...
Forum: General Help
Yesterday, 05:29 PM
» Replies: 0   » Views: 57

 
  Linking from database results table
Posted by: El Forum - 08-14-2007, 04:53 PM - Forum: Archived Development & Programming - Replies (4)

[eluser]danfloun[/eluser]
Hi,

I'm pulling some info from my database and laying it down like so:

Code:
<table>
    <tr>
        <th>Id</th>
        <th>Company</th>
        <th>First Name</th>
        <th>Last Name</th>
        <th>Landline Tel</th>
        <th>Mobile Tel</th>
        <th>Fax Tel</th>
        <th>Email</th>
    </tr>
    
&lt;?php foreach($query->result() as $row): ?&gt;

    <tr><a href="&lt;?=site_url('main/client_detail/' .$row->id);?&gt;">
        <td>&lt;?=$row->company;?&gt;</td>
        <td>&lt;?=$row->first_name;?&gt;</td>
        <td>&lt;?=$row->last_name;?&gt;</td>
        <td>&lt;?=$row->landline_tel;?&gt;</td>
        <td>&lt;?=$row->mobile_tel;?&gt;</td>
        <td>&lt;?=$row->fax_tel;?&gt;</td>
        <td>&lt;?=$row->email;?&gt;</td></a>
    </tr>

&lt;?php endforeach;?&gt;

</table>

Probably a crap way to do it, but nevertheless it works except I'm not sure how to make each full row linkable to the details page. I've checked an old project and the above worked but not here.

I'm sure the link I have is completely wrong so if anyone can help that would be cool.

I don't just want one column to be linkable I want the whole row.

Thanks

Danny


  ACL - Have I understood?
Posted by: El Forum - 08-14-2007, 04:36 PM - Forum: Archived Development & Programming - Replies (6)

[eluser]Kemik[/eluser]
Hello,

I'm building a competition website for PlayStation 3 clans (teams). I'm setting up a system with a pyramid style basic admin system (e.g root, admin, user, non-site-member).

However, all levels of user must be able to create a clan or join a clan. They cannot have access to clan areas (such as edit clan profile, challenge another clan to a game, etc) unless they are a member of a clan or clan leader. If the root isn't in a clan, they obviously won't be able to this.

So, I looked at rapyd's ACL system. It's the first time I've looked at an ACL system backend.

I've created a two page pdf with the different tables in as an example. Could you please tell me if the setup I've created is correct and matches the statements at the bottom of the page. Apologies if you hate pdf's but I cannot show tables here.

http://www.seanharrison.co.uk/security_roles.pdf

Thanks again for all your help.


  Login script with validation
Posted by: El Forum - 08-14-2007, 02:53 PM - Forum: Archived Development & Programming - Replies (6)

[eluser]codex[/eluser]
Yeah, I know that there's a few scripts out there, but I want to understand how and why things work like they do, just for a better overall understanding.

Imagine a homepage with a small loginbox (username, password, submit). The data needs to be checked against a database. You know the drill.

Using validation and callback, how would you go about? I've made a callback for the username, but there seems to be no way to send the password for checking also. Should I make 2 seperate callbacks instead of trying to do it in one? Is it even possible?


da rules:

Code:
$rules['user_name']            = "required|callback_check_logindata";
        $rules['user_password']        = "required";
        $this->validation->set_rules($rules);


da callback:
Code:
function check_logindata($username, $password)
    {
        if (!$this->login_model->check_login_data($username, $password)) {
            $this->validation->set_message('check_logindata', 'Logindata incorrect!');
            return FALSE;
        }
    }


  Creating Back & Next for forms
Posted by: El Forum - 08-14-2007, 02:41 PM - Forum: Archived Development & Programming - Replies (4)

[eluser]eedfwChris[/eluser]
I was wondering if anyone has a solution on how to making Back & Next buttons work...

All I am doing is updating a single row with data, hitting next (or back to goto the previous row). I can make a Next work but I am not entirely sure how to create a Back type function.

Anyone have any pointers or starters? I am guessing the pagination class is kind of out of the question because it isn't designed to do form buttons.


  Working with forms: best practice -- PART II
Posted by: El Forum - 08-14-2007, 02:40 PM - Forum: Archived Development & Programming - Replies (1)

[eluser]fMertins[/eluser]
Hi,

What do you use when creating forms to add and update records? Usually I prefer to have only one form/view page, both for including and updating records, instead of having one page only for add records and other page only for updating records.

With this approach, I have a "formState" variable indicating to the view page (form) wich operation needs to be done: add or update. When in add mode, all HTML inputs have the "value" attribute equal = "" (empty), and when in update mode, I populate the values with correspondent database information.

I think if using independent forms/view pages, when I need to change one, so need to change other too... Because this I think better to have only one page and control the "mode".

But a simple "problem" to deal with this pattern is because some situations, the add and update forms aren´t 100% equals... (ie: a field in add mode it´s disabled, while in update mode it´s normal) Usually I deal with making some IF´s...

I´d like to know from community what are your opinions and solutions :-) Thanks for all and sorry bad english...


  Correct way to use homemade functions
Posted by: El Forum - 08-14-2007, 02:27 PM - Forum: Archived Development & Programming - Replies (10)

[eluser]tinawina[/eluser]
This has to be easy! But new to CI and OOP and I'm just not able to get this simple thing to work.

As a first step, I just want to display a page that gets a variable from the data array from a homemade function that I have placed in a homemade helper file. I understand from the User Guide that I can create my own helper files and either place them in the system "helpers" folder or place them in a folder that I create and label "helpers" in my "application" folder. CI will look in the applications/helpers folder first, and if not found there, it will check the system/helpers folder. All of the functions contained in the file can be used throughout my application -- global scope. As long as I label my files so that they end with "_helper.php" I should be good to go.

Ok. I've created a "helpers" folder in my application folder, and I made a helper file called "my_helper.php". Here's the contents of that file:

application/helpers/my_helper.php

Code:
function hello() {
        $data['message'] = 'Hi there!';
    }

Here's my controller file:

application/controllers/test.php
Code:
class Test extends Controller {
    function Test()
    {
        parent::Controller();
        $this->load->helper('my'); // according to the User Guide, I don't have to tell CI where to find this file, or show the "_helper.php" part.
    }

    function index()
    {
        $data['testing'] = "Testing this out.";
        hello();
        $this->load->view('test', $data);
    }
}

And here's my view file:

application/views/test.php
Code:
&lt;html&gt;
&lt;head&gt;
&lt;title&gt;test&lt;/title&gt;
&lt;/head&gt;
&lt;body&gt;
<p>&lt;?php echo $testing; ?&gt;</p>
<p>&lt;?php echo $message; ?&gt;</p>
&lt;/body&gt;
&lt;/html&gt;

When I peek at this in my browser, I see:

Testing this out.

A PHP Error was encountered

Severity: Notice

Message: Undefined variable: message

Filename: views/test.php

Line Number: 10

So it's showing me $data['testing'] but not $data['message'] which is tucked away in the my_helper.php file but should be available to the entire application. I think.

Really feeling like a neeeewbiiiiiie.... Appreciate any help offered!


  Application Framework and Content Management System
Posted by: El Forum - 08-14-2007, 02:18 PM - Forum: Archived General Discussion - Replies (3)

[eluser]StormStrikes[/eluser]
Hello all.

Ive been kinda looking around some trying to discover what I can about CodeIgniter. I found the site in a search for a new CMS. The descriptions, general information I am reading an such are a tad exciting.

I am, however, left with trying to figure out what if any differences there may be in the description of a 'Web Application Framework' over 'Content Management System'. I currently use Joomla and have now for problably close to two years. I like Joomla but it just seems to lack in areas. It seems more geared towards someone with either large traffic sites, sites with lots of advertising, or basically anything other than someone that just wants to put up a good semantically correct website. There are a lot of 'major' features for websites that just have not been well developed such as ecommerce, mailing lists and so forth.

So Im here trying to find a new CMS. I like the idea of a content management system, it does make things easier in many respects, but I just feel I need more flexibility than Joomla offers. However, I am not php savvy though I would like to try and learn.

Anyway, if anyone can shed some light on the differences and what challenges I may face in trying to build a site with CodeIgniter I would appreciate it. Keep in mind I am new and Im still digging around the site looking at the Wiki and documentation.


  Thinking about porting CodeIgniter..
Posted by: El Forum - 08-14-2007, 12:36 PM - Forum: Archived General Discussion - No Replies

[eluser]Lovecannon[/eluser]
Ive more or less started using Java Servlets and JSP to do a business website, and so far Ive tried most of the Java web frameworks out there, and I hate how they work..using XML configuration files that act as controllers, it all seems out of place, so Ive had to resort to using my own MVC, which is just a JSP/Servlets combo. And I love CodeIgniter, and Ive been thinking about porting a variation of it to Java. Im just announcing this, it would be nice if someone could help me out if you know Java, and I was just curious about the creators thoughts on this.


  Image manipulation bug
Posted by: El Forum - 08-14-2007, 10:38 AM - Forum: Archived Development & Programming - Replies (3)

[eluser]EugeneS[/eluser]
ok here is code i use:

Code:
$this->load->library('image_lib');

                // START Image resizing
                $config['source_image'] = $this->dir_to_upload.$this->file_name;
                $config['quality'] = '100%';
                $config['width'] = '80';
                $config['height'] = '80';
                $config['create_thumb'] = true;
                // END Image resizing
                $this->image_lib->initialize($config);

                $this->image_lib->resize();

                // START watermarking the image
                $config['source_image'] = $this->dir_to_upload.$this->file_name;
                $config['create_thumb'] = false;
                $config['wm_type'] = 'overlay';
                $config['wm_overlay_path'] = $this->dir_to_upload.'../watermark.gif';
                $config['wm_vrt_alignment'] = 'bottom';
                $config['wm_hor_alignment'] = 'right';
                // END watermarking the image

                $this->image_lib->initialize($config);

                $this->image_lib->watermark();


without $config['create_thumb'] = false; in the watermarking config it:
1) removes previously created thumb
2) it keep initial big image NOT watermarked
3) it creates fullsize image with the postfix _thumb and watermark it

it seems to me that Initialize method do not reset some internal variables inside the class after the previous operation.

PS: it doesnt matter if for watermarking i rename $config to $config_wm (i just expect this proposal from you guys Smile )


first my try was (and supposed to work correct but it doesnt)
Code:
$this->load->library('image_lib');

                // START Image resizing
                $config['source_image'] = $this->dir_to_upload.$this->file_name;
                $config['quality'] = '100%';
                $config['width'] = '80';
                $config['height'] = '80';
                $config['create_thumb'] = true;
                // END Image resizing

                // START watermarking the image
                $config['wm_type'] = 'overlay';
                $config['wm_overlay_path'] = $this->dir_to_upload.'../watermark.gif';
                $config['wm_vrt_alignment'] = 'bottom';
                $config['wm_hor_alignment'] = 'right';
                // END watermarking the image

                $this->image_lib->initialize($config);

                $this->image_lib->resize();

                $this->image_lib->watermark();


  Redirect in constructor: good practice?
Posted by: El Forum - 08-14-2007, 10:32 AM - Forum: Archived Development & Programming - Replies (10)

[eluser]codex[/eluser]
If a user is not logged I want to restrict access to specific parts of a website. Is this the way to do it? I mean put the redirect in the constructor.

Code:
function Home()
    {
        parent::Controller();
        
        if (!$this->session->userdata('uid')) {
            redirect('/test/');
        }    
    }



  Theme © 2014 iAndrew  
Powered By MyBB, © 2002-2017 MyBB Group.