Welcome Guest, Not a member yet? Register   Sign In
  Query string: /search/?q=something&w=all works -> /search/?q=something doesn't
Posted by: El Forum - 10-20-2007, 11:22 AM - No Replies

[eluser]codex[/eluser]
w=all doesn't have any meaning, but it seems as if this string needs something, or at least an ampersand after the first part of the query string.

Oh yeah, query strings are disabled in the config.

Any ideas?


  How calling function
Posted by: El Forum - 10-20-2007, 09:59 AM - No Replies

[eluser]iniweb[/eluser]
Example:

News.php

Code:
<?php

class News extends Controller {

    function News()
    {
        parent::Controller();    
    }
    
    function Index()
    {
        $content = '';

        $content .= $this->uri->segment('1');

        $data = array(
                       'content'  => $content,
                 );

        $this->parser->parse('Empty.tpl', $data);
    }
}

?>

Code:
<?php

class Main extends Controller {

    function Main()
    {
        parent::Controller();    
    }

    function Func()
    {
        $content = "";

        $data = array(
                       'content'    => $this->News_block(),
                       'cat_block'  => $this->Cat_block(),
                                 );

        $this->load->library('parser');
        $this->parser->parse('Main.tpl', $data);
    }
}

?>

How on News class call Func() function !?


  Using interfaces in the system
Posted by: El Forum - 10-20-2007, 09:38 AM - No Replies

[eluser]Majd Taby[/eluser]
Hey, is there good reason (other than php5 dependance) Why the libraries don't use interfaces to make sure that any user created libraries work as drop-ins to existing ones? just seems like the right choice


  Autoloading library after my controller
Posted by: El Forum - 10-20-2007, 06:24 AM - No Replies

[eluser]Unknown[/eluser]
Hello!

I'm working on a site with a 3-panel layout. The left and right panels contains dynamic content such as news which is currently autoloaded with a library. The problem is that I'd like to be able to disable some or all of the panel content in some circumstances. I could solve it by using a different "main layout view" not containing for example the right panel, but there must be a better way? Is it possible to have a library loaded say after the currently loaded controller and have a var set telling the library not to do anything?

Thanks for looking;
Fredrik


  403 Forbidden for SEO friendly URLS??
Posted by: El Forum - 10-20-2007, 02:35 AM - No Replies

[eluser]@li[/eluser]
Hi,

I uploaded my site to a test server that my client provided. The site is working on my localhost, but when I uploaded to the test server and clicked any URLs which should bring up a controller, it gave a '403 Forbidden' error.

E.g if I click http://67.18.x.xxx/~test/login , then instead of bringing up Login controller, it gives the following error:

Quote:Forbidden
You don't have permission to access /index.php/login on this server.

Additionally, a 404 Not Found error was encountered while trying to use an ErrorDocument to handle the request.


--------------------------------------------------------------------------------

Apache/1.3.37 Server at 67.18.x.xxx Port 80

The site is uploaded to public_html folder. Here's the code I've put in the .htacces:

Code:
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ index.php/$1 [L]
</IfModule>

Any ideas how to fix this? I do have Cpanel access to the server.


  Create a backend in 10 min (my first video tutorial)
Posted by: El Forum - 10-20-2007, 01:59 AM - No Replies

[eluser]Majd Taby[/eluser]
Ok, this is kind of embarassing, here's my first ever tutorial, giving you a sneak peak at my admin generator. I create a CRUD in 10 minutes; albeit i copy-paste a lot of stuff. I should mention that the system comes with everything non-CI-standard you see (the login, messagin, admin and form generation).

So, here we go (10 min) http://jtaby.com:82/dump/jtaby-admin.mov

Please let me know what you think!

EDIT: here's a link to youtube: http://www.youtube.com/watch?v=hKFhtpsGpVM

The quality is crap..but it loads...the other one (hosted on my computer, doesn't even load for some people)


  Setting flashdata in the destructor
Posted by: El Forum - 10-19-2007, 11:41 PM - No Replies

[eluser]Majd Taby[/eluser]
Hi, I'm creating a messaging library, so that my code can relay messages to the user. I'm setting flashdata so that the messages are contained in some form until they can actually be used.

Here's the problem:
Throughout my code, I'm building the array of the messages (There could be more than one message per-page). So the best way i found to set the flashdata was in the destructor, where all the messages are already added.

How can i delay the output until after the destructor?



p.s. If it has anything to do with output buffering, then i can't figure it out..i've been adding ob_start() and ob_end_flush() everywhere...i've never needed them so i don't exactly know where they go in the codeigniter system.

EDIT: I found the following solution:

Code:
function add($type,$message){
        $this->messages[$type]['messages'][] = $message;
        $messages = $this->CI->session->flashdata('jtabymessages_'.$type);
        $messages[$type][] = $message;
        $this->CI->session->set_flashdata('jtabymessages_'.$type,$messages);
    }

However, it's not the most elegant / efficient solution...what do you guys think?


  SEO-friendly URL's
Posted by: El Forum - 10-19-2007, 11:07 PM - No Replies

[eluser]jplanet[/eluser]
I am working on a CI ecommerce project. There are three main levels to the site:

- List of top-level categories
- List of subcategories under each category
- List of products under each sub-category

In the database, the Category and products tables both have a column called static_name. This is a plain-English name representation of the product or category, so that URL's can look like:

List of sub-categories for a given category:
www.example.com/category/Kids-Toys

and for product lists under each subcategory:
www.example.com/products/Board-Games

Now, this already seems quite optimized to me. My client is wondering if there would be any benefit to getting rid of the function names entirely, so that URL's would only contain they key, whether it was a category or product list:

www.example.com/Kids-Toys
and
www.example.com/Board-Games

To do this I would have to enforce a rule that every product and category must have a unique value in the static_file field. Then every URL request would run a query to see which table contains the value, and delegate to the applicable function.

Does this seem like a fundamentally bad idea? It strikes me that this structure could be quite fragile to maintain...Is there even anything gained as far as SEO goes, or is there some benefit that may be worth the trouble?


  Using Session Data captured by another application
Posted by: El Forum - 10-19-2007, 09:56 PM - No Replies

[eluser]Unknown[/eluser]
Hi,

Forgive my ignorance, i'm new to frameworks, classes and such.

I'm trying to figure out how i can use the framework with a membership/subscription/authentication application already in use. I'm a little confused as to how i can capture the session data within the framework.

It seems that the membership application has its own sessions class, and provides me with code to insert into every page, or alternatively, uses mod_rewrite for folder protection.

So i can assign redirect urls for particular "groups" within my subscription administration so i put the framework folder under a protected group. I can login fine, but i don't know how to produce the SESSION info this application captures and use it in the framework application.

I do know that to obtain SESSION info without using the framework i use the below code..

Code:
session_start();
require_once '/path/to/settings.php';
require_once '/path/to/members/lib/userValidator.class.php';
$authClass=new userValidator(19);
$authClass->validateRequest();
$array = $_SESSION["omniSecure"];

Any ideas/suggestions would be greatly appreciated.

Cheers,

Nikki


  mysql between dates function
Posted by: El Forum - 10-19-2007, 09:29 PM - No Replies

[eluser]megabyte[/eluser]
OK, I've succesfully done this, until I figured out it only works if your current date can allow a 10 days to be subtracted.

How do you do this so it wouldnt matter what date it was?



here's what I got, which is limited if its the first of the 10th of the month or less.

Code:
function _show_web_stats()
    {
    $this->db->select('UserId, date_format(Date,\'%Y-%m-%d\') as Date, count(Date) as Visitors, SUM(Hits) as NoOfHits');
    $this->db->groupby("Date");
    $this->db->where('UserId', $this->userid);
    $then = date('Y-m-d', now());
    $then = explode('-', $then);
    $then[2] = $then[2] - 15;
    $past = implode('-', $then);
    $this->db->where("Date between '$past' and 'Date' ");
    $this->db->orderby("Date", "asc");
    //returns the query string
    $query = $this->db->get('WEB_stats');
    
    return $query;
    }


I need help, lol. I've searched the net and hit a learning curve here.


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

Username
  

Password
  





Latest Threads
Changing Session cookie -...
by codeus
1 hour ago
hot-reload side effects s...
by InsiteFX
4 hours ago
using app/Config/App.php ...
by sam547
11 hours ago
Setting baseURL in Regist...
by grimpirate
05-15-2025, 02:20 PM
CRUD Code Generator
by DeanE10
05-15-2025, 05:31 AM
CodeIgniter.com - Report ...
by Harry Lyre
05-14-2025, 04:26 AM
Missing closing bracket w...
by abf
05-13-2025, 07:27 PM
Update from 4.6.0 to 4.6....
by FlavioSuar
05-13-2025, 04:17 AM
Sessions old files are de...
by InsiteFX
05-12-2025, 10:30 PM
Ajax post failing with Ty...
by PaulC
05-12-2025, 12:23 AM

Forum Statistics
» Members: 146,482
» Latest member: kbetfood
» Forum threads: 78,392
» Forum posts: 379,462

Full Statistics

Search Forums

(Advanced Search)


Theme © iAndrew 2016 - Forum software by © MyBB