Welcome Guest, Not a member yet? Register   Sign In
  Segment troubles + new problem
Posted by: El Forum - 06-24-2008, 07:36 AM - Replies (2)

[eluser]Jesse2303[/eluser]
Hi all

A word before
Yes, I have red the user docs.
Yes, I tried to solve this on my own, but I can't solve this.

Ok, here we go. I have a fucntion that calls nieuws_bekijk and I have a view file nieuws_bekijk_view.php

Well , when I run the script, it says:

Quote:A PHP Error was encountered

Severity: Notice

Message: Undefined property: Main::$url

Filename: controllers/main.php

Line Number: 62

Quote:Fatal error: Call to a member function segment() on a non-object in C:\UsbWebserver\Root\ciAdmin\system\application\controllers\main.php on line 62

What I need to do ?

The function
Code:
function nieuws_bekijk() {
        
        $this->db->where('nieuwsid', $this->url->segment(3));
        $data['query']= $this->db->get('nieuws');
        
        $this->load->view('nieuws_bekijk_view');
    }

nieuws_bekijk_view.php
Code:
<!-- Kleine stijlwijziging van het extern stijlbestand -->
<style type="text/css">
.style7 {font-size: 12px; font-weight: bold; font-family: Verdana, Arial, Helvetica, sans-serif; color: #FFFFFF; }
.style16 {
    font-size: 12px;
    font-family: Verdana, Arial, Helvetica, sans-serif;
    color: #000000;
}
.style17 {color: #000000}
</style>

<!-- Login check -->

<?php if(isset($_SESSION['gebruiker'])) { ?>

<?php foreach($query->result() as $row):?>
    
    <!-- Tabel waar het nieuws instaat. -->
    <table width="100%" border="0">
    
        &lt;!-- Naam --&gt;
        <tr>
            <td width="31%" bgcolor="#90897a" class="style7"><div align="right">Naam</div></td>
            <td width="69%" bgcolor="#e1ddd9" class="style16">&lt;?php echo $row->admin; ?&gt;</td>
          </tr>
          &lt;!-- Datum --&gt;
        <tr>
            <td bgcolor="#90897a" class="style7"><div align="right">Datum</div></td>
            <td bgcolor="#e1ddd9" class="style16">&lt;?php echo date('D d, F, Y H:i', $row->datum); ?&gt;</td>
        </tr>
        &lt;!-- Onderwerp --&gt;
        <tr>
            <td bgcolor="#90897a" class="style7"><div align="right">Onderwerp</div></td>
            <td bgcolor="#E1DDD9"  class="style16">&lt;?php echo $row->onderwerp; ?&gt;</td>
          </tr>
          &lt;!-- Bericht --&gt;
          <tr>
              <td align="right" valign="top" bgcolor="#90897a" class="style7"><div align="right">Bericht</div></td>
            <td align="left" valign="top" class="style16">&lt;?php echo nl2br($row->bericht); ?&gt;</td>
          </tr>
    
    </table>
    

&lt;?php endforeach; ?&gt;

&lt;!-- Niet ingelogd --&gt;

&lt;?php } else { ?&gt;

    <p>
        U moet inloggen om deze pagina te bekijken.
    </p>

&lt;?php } ?&gt;


  File Upload Class: Pass in new file name
Posted by: El Forum - 06-24-2008, 07:28 AM - Replies (2)

[eluser]louis w[/eluser]
It would be nice to be able to pass a value in to the do_upload method which is what you want the uploaded file to be named. I am saving files by their id, so need to rename it.

I can hack this by changing the name in $_FILES, but a real solution would be better.


  Email library prob
Posted by: El Forum - 06-24-2008, 07:22 AM - Replies (2)

[eluser]edhrx[/eluser]
I am trying to send out an email using the CI email library the debug gives me this

Unable to send email using PHP mail(). Your server might not be configured to send mail using this method.

but..sending out by good old php mail function works. Do they use different protocols

Ed.


  quick question on 'math' in codeigniter
Posted by: El Forum - 06-24-2008, 07:11 AM - Replies (4)

[eluser]Unknown[/eluser]
I have a quick question about CodeIgniter. A couple years back, in PHP/ADOdb411, I created a system that allowed fans of a soccer team to come the site and rate the players on their performance 1-10, then display the average rating.

The way I had it structured was I had the following tables in MySQL: player, game, rating. The rating table had the rating value, but also had foreign keys for the player and the game. Then whenever the games page was displayed I'd set my query to AVG(rating_value) as average_rating for each player.

Is this possible to do in CodeIgniter? Is there a better way than I did it previously?


  SOLVED: Add <div> around every 10 queried results?
Posted by: El Forum - 06-24-2008, 07:07 AM - Replies (4)

[eluser]Joakim_[/eluser]
Hi. I wondering if it's possible to add a <div> around every 10 queried results, without using multiple queries.

Let's say there are 22 results from the query and I want something like this:

Code:
<div class="item_holder">
<li>&lt;?php echo $row->item ?&gt;</li>
<li>&lt;?php echo $row->item ?&gt;</li>
<li>&lt;?php echo $row->item ?&gt;</li>
<li>&lt;?php echo $row->item ?&gt;</li>
<li>&lt;?php echo $row->item ?&gt;</li>
<li>&lt;?php echo $row->item ?&gt;</li>
<li>&lt;?php echo $row->item ?&gt;</li>
<li>&lt;?php echo $row->item ?&gt;</li>
<li>&lt;?php echo $row->item ?&gt;</li>
<li>&lt;?php echo $row->item ?&gt;</li>
</div>

<div class="item_holder">
<li>&lt;?php echo $row->item ?&gt;</li>
<li>&lt;?php echo $row->item ?&gt;</li>
<li>&lt;?php echo $row->item ?&gt;</li>
<li>&lt;?php echo $row->item ?&gt;</li>
<li>&lt;?php echo $row->item ?&gt;</li>
<li>&lt;?php echo $row->item ?&gt;</li>
<li>&lt;?php echo $row->item ?&gt;</li>
<li>&lt;?php echo $row->item ?&gt;</li>
<li>&lt;?php echo $row->item ?&gt;</li>
<li>&lt;?php echo $row->item ?&gt;</li>
</div>

<div class="item_holder">
<li>&lt;?php echo $row->item ?&gt;</li>
<li>&lt;?php echo $row->item ?&gt;</li>
</div>

Thank you very much for your help!Smile


  Image upload + resizing + watermarking + form to database
Posted by: El Forum - 06-24-2008, 05:15 AM - Replies (10)

[eluser]Bramme[/eluser]
Okay, I'm a bit stuck on how to approach the following:

I'm working on a backend for a painter, which has, offcourse, a portfolio section. Now to add a piece to the portfolio, the painter has to fill out a form: select the category (drawings, portraits etc), select a file from his hard drive and then enter some optional data like a title, size of the work, if it's in a private collection etc...
When the form is submitted the image has to be resized if it's too big, a thumbnail has to be cached, the resized image has to be watermarked with a png and then the other data from the form has to be added to the database.

Now, I was looking at the user guide, looking up info about all the libraries I would need, but I'm a bit confused now.

If you want to watermark image, you gotta have the CHMOD set to 777, is that possible with newly uploaded images?

Is there anyone who could roughly sketch out how I should tackle this ?


  custom Hostname in curl ??
Posted by: El Forum - 06-24-2008, 04:46 AM - No Replies

[eluser]bilal ghouri[/eluser]
How can I set a custom hostname in Curl?
like, when I open a page using curl on my localhost, it says hostname localhost is banned
how do I set a custom one ??


  Building Facebook-like feed feature
Posted by: El Forum - 06-24-2008, 04:19 AM - Replies (1)

[eluser]ericbae[/eluser]
Hi,

I want to know what is the best way to start implementing my own "feed" system like ones in Facebook, where it updates of relevant news from friends, groups, etc.

Is this same as RSS feed?

What is the best way to go about this? Any tutorials available?

Thanks in advance!


  Menu sessions
Posted by: El Forum - 06-24-2008, 04:06 AM - Replies (2)

[eluser]Jesse2303[/eluser]
Hi all
My login works again, and I've made 2 sessions, you can see below.
When I log in with my login. Everything works fine but only the menu won't update. What I'm doing wrong ?

O, the autoload.php , I added sessions too to the array.

Code:
$this->session->set_userdata('login', '1');
            $this->session->set_userdata('gebruiker', $_POST['name']);



Code:
&lt;?php
        if(isset($_SESSION['gebruiker'])){
    ?&gt;
            admin     &lt;?=anchor('dashboard', 'dashboard');?&gt; begin
                  - &lt;?=anchor('login', 'uitloggen');?&gt;  
            modules &lt;?=anchor('pics', 'afbeeldingen');?&gt;  
                  - &lt;?=anchor('nieuws', 'nieuws');?&gt;
    &lt;?php
        }
            else
        {
    ?&gt;
        gast  &lt;?=anchor('main/index', 'begin');?&gt;
            - &lt;?=anchor('main/login', 'login');?&gt;</a>
            - &lt;?=anchor('main/contact', 'contact', '');?&gt;</a>
    &lt;?php
        }
    ?&gt;


  Model Functions - Same Code
Posted by: El Forum - 06-24-2008, 03:42 AM - Replies (6)

[eluser]Yash[/eluser]

Code:
class Usersmodel extends Model {

    function Usersmodel()
    {
        // Call the Model constructor
        parent::Model();
    }
    
    function Abc()
    {
    //some code is here
    }
        
        function 123()
       {//I want to use here

        }

        function TBG()
       {//I want to use and here

        }

}

How can we do this?


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

Username
  

Password
  





Latest Threads
Codeigniter Shield Bannin...
by kenjis
48 minutes ago
SQL server connection not...
by kenjis
1 hour ago
Best way to create micros...
by kenjis
3 hours ago
How to use Codeigniter wi...
by kenjis
3 hours ago
Getting supportedLocales ...
by kcs
9 hours ago
Component help
by FlashMaster
Today, 01:41 AM
Show logo in email inbox
by WiParson
Today, 12:48 AM
CI 4.5.1 CSRF - The actio...
by jackvaughn03
Yesterday, 10:17 PM
Limiting Stack Trace Erro...
by byrallier
Yesterday, 02:21 PM
Bug with sessions CI 4.5....
by ALTITUDE_DEV
Yesterday, 01:36 PM

Forum Statistics
» Members: 85,228
» Latest member: 789club15vip
» Forum threads: 77,577
» Forum posts: 375,977

Full Statistics

Search Forums

(Advanced Search)


Theme © iAndrew 2016 - Forum software by © MyBB