Welcome Guest, Not a member yet? Register   Sign In
  Help ?????? Any body can do this.
Posted by: El Forum - 05-30-2008, 12:28 AM - No Replies

[eluser]Shahgeb[/eluser]
Hi Every body.
it is highly appreciated that i am facing problem with getting related news when we have news like "
Suppose News is :NewYork stock exchange goes down up to 12%.
and in half portion of the page i have all related news about newyork stock exchange.
how we can do this plz send me logic that is used behind this.
and code also with simple example if possible.



Best Regard
Amjad Farooq


  semi complex query in active record
Posted by: El Forum - 05-29-2008, 11:09 PM - Replies (1)

[eluser]Majd Taby[/eluser]
Hey guys, I'm wondering if someone has come across the same issue and solved it, I want to run the following query through active record:

Code:
SELECT r.forum_name
     , t.thread_name
     , u.display_name
     , m.max_last_posted
     , r.id as reply_id
  FROM ( SELECT thread_id
              , MAX(date_posted) AS max_last_posted
           FROM forum_replies
         GROUP
             BY thread_id ) AS m
INNER
  JOIN forum_threads AS t
    ON t.id = m.thread_id

INNER
  JOIN forum_rooms AS r
    ON t.room_id = r.id

INNER
  JOIN forum_replies as reply
    ON reply.date_posted = m.max_last_posted
   AND reply.thread_id = m.thread_id

INNER
  JOIN users AS u
    ON reply.user_id = u.id

so I set it up as follows:

Code:
$this->db->select('r.forum_name, t.thread_name, u.display_name, m.max_last_posted')
                 ->from('(SELECT thread_id , MAX(date_posted) AS max_last_posted FROM forum_replies GROUP BY thread_id) AS m')
                 ->join('forum_threads AS t','t.id = m.thread_id','inner')
                 ->join('forum_rooms AS r','t.room_id = r.id','inner')
                 ->join('forum_replies AS new_r','r.id = new_r.id','inner')
                 ->join('users AS u','new_r.user_id = u.id','inner');

The above php produces the following query:

Code:
SELECT r.forum_name, t.thread_name, u.display_name, m.max_last_posted
FROM ((`SELECT` thread_id , MAX(`date_posted`) `max_last_posted` FROM `forum_replies` GROUP `BY` thread_id) `m`)
INNER JOIN `forum_threads` AS t ON t.id = m.thread_id
INNER JOIN `forum_rooms` AS r ON t.room_id = r.id
INNER JOIN `forum_replies` AS new_r ON r.id = new_r.id
INNER JOIN `users` AS u ON new_r.user_id = u.id

Notice how SELECT, max_last_posted, BY, and m are escaped as table names in the second line.


  Need help to improve data import from text file
Posted by: El Forum - 05-29-2008, 10:43 PM - Replies (2)

[eluser]thinzar[/eluser]
I'm currently working on an application (Import Module) where it import data from text file which the user uploaded.

The problem is the import works fine if the record is < 20,000.. but it can't handle if it is more than that.
Possible problems that i can think of are:
1. Since CI is using persistent SQL connection, there might be connection time out problem
2. Is it because of the cache limit exceed since it has to hold a long SQL query? (but even if i insert one record after another, the connection time-out problem occur.)

This is my first project using CI, so i'm not very familiar with its functionalities yet. Please give me suggestions on how to improve the performance since the module needs to handle data import of large data set. Or if there is any other method that i can use (rather than trimming each record and inserting one by one)?

The partial code snippet is as below..

Code:
function importData($filepath, $data, $datasource){
            $fs = fopen($filepath, 'r');
            $id = $this->getNextClientID();

            $id++;

            $queries = "";

            while (!feof($fs) )
            {
                $sql = "";
                $line = fgets($fs);

                // data format
                $name= trim(substr($line, 0, 12));
                $age= trim(substr($line, 13, 8));
                $address= trim(substr($line, 22, 80));
                $dob = trim(substr($line, 103, 10));
                $maritalStatus = trim(substr($line, 114, 1));

                if(!$this->checkClientExistsByName($name)){
                        $sql = " INSERT INTO clients (client_id, client_name, client_age, client_addr, client_dob, client_maritalstatus) ";
                        $sql.= " VALUES($id, $name, $age, ".$this->db->escape($address).", ".$this->db->escape($dob).", $maritalStatus";
                        
                        $id++;
                        $queries .= $sql . "\n";
                }
                else{
                                       //ignore the record
                }
            }
            if($queries != ""){
                $this->db->query($queries);
            }
}
Thanks in advance.
P.S. I'm using PostgreSQL. will COPY instead of INSERT work?


  Load index.html file instead of index.php first?
Posted by: El Forum - 05-29-2008, 09:54 PM - Replies (1)

[eluser]Computerzworld[/eluser]
Hello. I am having a problem that I want to load index.html file instead of default index.php. I want to load index.html because it contains the javascript code for ajax preloader and that calls my index.php. but I am unable to load index.html directly. Which changes I have to make in order to load index.html? Here is the .htaccess file which is at the root of my site.

Code:
RewriteEngine on
RewriteCond $1 !^(index\.php|images|css|uploads|jscripts|robots\.txt)
RewriteRule ^(.*)$ index.php/$1 [L]

Please help me. Thank you in advance.


  trying to creATE A PDF FILE USING PHP and CodeIgniter.
Posted by: El Forum - 05-29-2008, 09:29 PM - Replies (9)

[eluser]RaiNnTeaRs[/eluser]

Code:
$pdf = pdf_new();
    pdf_open_file($pdf,"http://192.168.1.188/ci2/report/report.pdf");
    pdf_set_info($pdf, "Author", "Sales-admin");
    pdf_set_info($pdf, "Title", "Confirmation report");
    pdf_set_info($pdf, "Creator", "www.a.com");
    pdf_set_info($pdf, "Subject", "Order Confirmation");
    
    pdf_begin_page($pdf, 595, 842);

My error message:
Fatal error: Uncaught exception 'PDFlibException' with message 'Function must not be called in 'object' scope' in C:\xampp\htdocs\ci2\system\application\controllers\dojang.php:1019 Stack trace: #0 C:\xampp\htdocs\ci2\system\application\controllers\dojang.php(1019): pdf_begin_page() #1 C:\xampp\htdocs\ci2\system\codeigniter\CodeIgniter.php(224): Dojang->report(Resource id #48, 595, 842) #2 C:\xampp\htdocs\ci2\index.php(115): require_once('C:\xampp\htdocs...') #3 {main} thrown in C:\xampp\htdocs\ci2\system\application\controllers\dojang.php on line 1019


  Code Separation
Posted by: El Forum - 05-29-2008, 08:58 PM - Replies (13)

[eluser]phybertek[/eluser]
Hello,

I've used scaffolding to design an application for my site. It is great for adding testing data, but now I am moving to the user and administration phase. I'm looking into building form inputs. I have one question about this process. How are people seperating code and html with in their projects for forms.

I understand the process of controllers and views, but how are people in the CI world keeping their views clean for html designers and their Controllers doing all of the logic?

Can someone share an example of one of their controllers or models with form building kept seperated? Or, where can I get this information from. I was looking into pagination, but I can not figure out how to keep all of that out of my view.

Phybertek


  urgent: Fatal error: out of dynamic memory in yy_create_buffer()...
Posted by: El Forum - 05-29-2008, 07:11 PM - Replies (2)

[eluser]daulex[/eluser]
Really nee help on this one:
I get:

Quote:Fatal error: out of dynamic memory in yy_create_buffer() in /home/sites/galenko.co.uk/public_html/dev/ll/system/libraries/Language.php on line 77

this shows up when I load my news page, here are the functional bits of it:
here is the news.php controller
Code:
&lt;?
class News extends Controller {
    function News(){
    parent::Controller();
    
    $this->load->helper('url');
    $this->load->helper('form');
    }
function index()
{
    $data['query'] = $this->db->order_by("id", "DESC");
    $data['query'] = $this->db->get('template');
    $this->load->view('news',$data);
}
function view(){
    $data['query'] = $this->db->order_by("id", "DESC");
    $data['query'] = $this->db->get('template');
    
    $this->db->where('id',$this->uri->segment(3));
    $data['query2'] = $this->db->order_by("id", "DESC");
    $data['query2'] = $this->db->get('template');
    
    $this->load->view('view_news',$data);
}
}
?&gt;
here is the view code:
Code:
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
&lt;html lang="en" xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" dir="ltr"&gt;
&lt;head&gt;
    &lt;title&gt;The London Legends - News&lt;/title&gt;
    &lt;meta http-equiv="imagetoolbar" content="no" /&gt;
    &lt;meta name="MSSmartTagsPreventParsing" content="true" /&gt;
    &lt;meta name="description" content="The London Legends - News" /&gt;
    &lt;meta http-equiv="Content-Type" content="text/html; charset=utf-8" /&gt;    
    &lt;link rel="stylesheet" type="text/css" href="&lt;?=base_url()?&gt;system/application/views/styles/screen-main.css" media="screen, print" /&gt;    
    
&lt;/head&gt;
&lt;body&gt;
<div id="doc">
    <div id="header">
<a href="&lt;?=base_url()?&gt;index.php/site/" title="The London Legends"><img src="&lt;?=base_url()?&gt;system/application/views/images/logo.png" alt="The London Legends" width="782" height="97"></a></div>
    <div id="sidebar-a">
<div class="box">
<ul>
<li><a href="&lt;?=base_url()?&gt;index.php/site/thelegendshousehold/"><img src="&lt;?=base_url()?&gt;system/application/views/images/star.gif" />The Legends Household</a></li>
<li><a href="&lt;?=base_url()?&gt;index.php/site/thekingsrole"><img src="&lt;?=base_url()?&gt;system/application/views/images/star.gif" />The King’s Role</a></li>
<li><a href="&lt;?=base_url()?&gt;index.php/site/thelegendscollection"><img src="&lt;?=base_url()?&gt;system/application/views/images/star.gif" />Art & Residences</a></li>
<li><a href="&lt;?=base_url()?&gt;index.php/site/thekingsworkingday"><img src="&lt;?=base_url()?&gt;system/application/views/images/star.gif" />The Kings’ Working Day</a></li>
<li><a href="&lt;?=base_url()?&gt;index.php/site/crestsandsymbols"><img src="&lt;?=base_url()?&gt;system/application/views/images/star.gif" />Crests & Symbols</a></li>
<li><a href="&lt;?=base_url()?&gt;index.php/site/thelegendsarchives"><img src="&lt;?=base_url()?&gt;system/application/views/images/star.gif" />The Legends Archives</a></li>
<li><a href="&lt;?=base_url()?&gt;index.php/site/historyofthelegends"><img src="&lt;?=base_url()?&gt;system/application/views/images/star.gif" />History of The Legends</a></li>
<li><a href="&lt;?=base_url()?&gt;index.php/news/" class="hl"><img src="&lt;?=base_url()?&gt;system/application/views/images/star.gif" />News</a></li>
<li><a href="&lt;?=base_url()?&gt;index.php/site/contact"><img src="&lt;?=base_url()?&gt;system/application/views/images/star.gif" />Contact</a></li>
<li><a href="&lt;?=base_url()?&gt;index.php/site/links"><img src="&lt;?=base_url()?&gt;system/application/views/images/star.gif" />Links</a></li>
</ul>

</div>
<img src="&lt;?=base_url()?&gt;system/application/views/images/logo_small.png" style="padding-left:1px;" />
</div>
    
    <div id="content">    
<div class="newsbox">
<div class="nbcontainer">
&lt;? foreach($query->result() as $row): ?&gt;
<p>&lt;?=anchor('news/view/'.$row->id, ''.$row->title)?&gt; (&lt;?=$row->date?&gt;)</p>
&lt;? endforeach;?&gt;
</div>
</div>
<div class="contentboxq">
Information about Royal Legends news and future Royal engagements.<br />

</div>
<div>
    
  
    
    <div class="c"></div>
    
</div>    </div>
  <blockquote>&nbsp;</blockquote>
  <div class="c"></div>
    
    <div id="footer"><span style="padding-left:25px;">copyright London Legends 2008</span></div>

</div>
&lt;/body&gt;
&lt;/html&gt;

what really pisses me off is that it works fine on my pc, but when I upload it, it all crashes Sad
the site works well otherwise, check it out: http://dev.galenko.co.uk/ll however when you click on the news link, it all falls down and I really don't know what to do... please help...

been working on javascript and the cms for this site all day and its 2am now, damn why does it not work Sad

please help


  Very Annoying CSS Problem
Posted by: El Forum - 05-29-2008, 04:15 PM - Replies (2)

[eluser]Jamie Rumbelow[/eluser]
Hello!

I'm being bugged by a css problem I'm having. I want the navigation bar to site perfectly under the header image, but it is leaving a gap. 2 hours infront of Firebug and TextMate, with no results drove me to the community for help.

index.htm

Code:
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
&lt;html xmlns="http://www.w3.org/1999/xhtml"&gt;
&lt;head&gt;
    
    &lt;title&gt;Host It, Baby!&lt;/title&gt;
    &lt;link type="text/css" rel="stylesheet" href="style.css" /&gt;

&lt;/head&gt;

&lt;body&gt;
    
    <div id="container">
        
        <a href="#"><img src="images/header.png" alt="hostitbaby" class="noborder" /></a>
        
        <div id="nav">
            
            <ul>
                
                <li><a href="#">Home</a></li>
                <li><a href="#">Sorry, What?</a></li>
                <li><a href="#">My Files</a></li>
                <li><a href="#">Upgrade</a></li>
                <li><a href="#">Forums</a></li>
                
            </ul>
            
        </div>
        
        <div id="content">
            
            <h2>News Post</h2>
            <small>Posted on 08/12/2008 by Jamie</small>
            <p>BlahBlahBlahBlahBlahBlahBlahBlahBlahBlahBlahBlahBlahBlahBlahBlahBlahBlahBlahBlahBlahBlahBlahBlahBlahBlahBlahBlahBlahBlahBlahBlahBlahBlahBlah</p>
            
        </div>
        
        <div id="sidebar">
            
            <ul>
                
                <li>
                    
                    <h2>Log In!</h2>
                    
                    &lt;form method="post" action="#"&gt;
                        
                        &lt;input type="text" name="username" id="username" /&gt;<br />
                        &lt;input type="password" name="username" id="username" /&gt;<br />
                        &lt;input type="submit" name="username" id="username" value="Log In!" /&gt;
                    
                    &lt;/form&gt;
                    
                </li>
                
                <li>
                    
                    <h2>Sidebar Things</h2>
                    <p>Ladidadida.</p>
                    
                </li>
                
            </ul>
            
        </div>
        
        <div id="footer">
            
            <a href="http://www.jamierumbelow.net/"><img src="images/jamierumbelow.gif" alt="It's a JamieRumbelow Kinda Thing" /></a> | We love Valid Markup... | And Valid Stylesheets! | Wanna spread the word?
            
        </div>
        
    </div>

&lt;/body&gt;

&lt;/html&gt;





style.css
Code:
body {
    
    margin: 0;
    padding: 0;
    color: #402A01;
    font-width: 75%;
        
}

a {
    
    text-style: none;
    color: #402A01;
    margin: 0;
    padding: 0;
    
}

#container {
    
    width: 656px;
    margin-left: auto;
    margin-right: auto;
    margin-top: 20px;
    
}

#header {
    

    
}

#nav {
    
    background-color: #848C46;
    height: 51px;
    
}

#nav ul {
    
    line-height: 51px;
    white-space: nowrap;
    
}

#nav li {
    
    display: inline;

}

#nav a {
    
    height: 100%;
    padding: 16px;
    
}

#nav a:hover {
    
    background-color: #9DA658;
    
}

.noborder {
    
    border: 0pt none;
    
}

Thanks,

Jamie


  Calling controller methods from inside view
Posted by: El Forum - 05-29-2008, 04:07 PM - Replies (16)

[eluser]louis w[/eluser]
Is there a way to call a method inside the controller from your view without having to get the CI object (get_instance()). Is there some kind of variable which references the currently loaded controller?

UPDATE:
Strange, I can access variables with the $this-> way, but not methods. Is this correct?


  Multiple Sites with different configs / Multilingual sites
Posted by: El Forum - 05-29-2008, 04:01 PM - Replies (4)

[eluser]pwfraley[/eluser]
I am reviewing CI for a project we are doing and I have a couple of questions about multiple sites and multilingual applications:

1. Is it possible to have one application run multiple sites with differing configs?
2. I found a couple of threads regarding multilingual sites, but this seems to be a very complex thing, also changing some base behaviour of CI. Is there a CI endorsed standard way of handling multilingual sites?

thanks
patrick


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

Username
  

Password
  





Latest Threads
Codeigniter Shield Bannin...
by xsPurX
7 minutes ago
Best way to create micros...
by InsiteFX
4 hours ago
Component help
by FlashMaster
6 hours ago
Show logo in email inbox
by WiParson
7 hours ago
Limiting Stack Trace Erro...
by byrallier
Yesterday, 02:21 PM
Bug with sessions CI 4.5....
by ALTITUDE_DEV
Yesterday, 01:36 PM
codeigniter 3.0.1 equiped...
by JustJohnQ
Yesterday, 10:05 AM
Display a custom error if...
by b126
Yesterday, 06:22 AM
Type error in SYSTEMPATH\...
by DXArc
Yesterday, 06:20 AM
v4.5.1 Bug Fix Released
by LP_bnss
Yesterday, 04:52 AM

Forum Statistics
» Members: 85,193
» Latest member: m88sky
» Forum threads: 77,574
» Forum posts: 375,962

Full Statistics

Search Forums

(Advanced Search)


Theme © iAndrew 2016 - Forum software by © MyBB