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

Username
  

Password
  





Search Forums

(Advanced Search)

Forum Statistics
» Members: 15,451
» Latest member: aponton
» Forum threads: 70,547
» Forum posts: 362,799

Full Statistics

Latest Threads
How to create Controller ...
Forum: General Help
38 minutes ago
» Replies: 9   » Views: 175
How to enable debug toolb...
Forum: CodeIgniter 4 Support
1 hour ago
» Replies: 23   » Views: 1,213
How to integrate Python w...
Forum: General Help
1 hour ago
» Replies: 8   » Views: 209
Zip library "Allowed memo...
Forum: Libraries & Helpers
1 hour ago
» Replies: 0   » Views: 21
[feature] Database Handle...
Forum: CodeIgniter 4 Roadmap
2 hours ago
» Replies: 19   » Views: 4,937
Add TurboLinks to speedup...
Forum: CodeIgniter 4 Feature Requests
2 hours ago
» Replies: 1   » Views: 126
CodeIgniter - French Comm...
Forum: Regional User Groups
8 hours ago
» Replies: 35   » Views: 16,726
how create an self instal...
Forum: Installation & Setup
9 hours ago
» Replies: 4   » Views: 402
Important News about Jim ...
Forum: News & Discussion
10 hours ago
» Replies: 46   » Views: 11,685
How develop Model and val...
Forum: General Help
Today, 01:33 AM
» Replies: 12   » Views: 433

 
  Check if Image exists in folder
Posted by: El Forum - 07-10-2007, 05:14 AM - Forum: Archived Development & Programming - Replies (2)

[eluser]woracal[/eluser]
I need to display several images in a page. Some thumbnails images may not exist so I need to display an alternate image instead. Basically, i need to check if an image exists and display an alternative if it does not. Any comments would help.


  How to extend all my models?
Posted by: El Forum - 07-10-2007, 02:25 AM - Forum: Archived Development & Programming - Replies (4)

[eluser]MpaK69[/eluser]
Sorry for some stupid question.

But I want to extend all my models with some my methods like as set, get, update, save and more... or I can extend only Core classes?


  What time is it Mr Wolf? Issues with timespan :D
Posted by: El Forum - 07-09-2007, 11:38 PM - Forum: Archived Development & Programming - No Replies

[eluser]CI Lee[/eluser]
Hello All,

I was trying to find an answer to another problem, simple and in hindsight very easy; however no matter how I phrased it I could not find any topics that referenced it. So I had to ask in a post...

This may seem simple to some but I am sure it may help others in the future and by bolstering the search results, reducing the novice questions.

I am building a CMS and I would like to alert the user when something has reached a threshold in time. Now its rudimentary but it works... kinda(get to that in a second) this is what I have

Code:
<div id="date" style="float:right; width:90%" >
                <p>&lt;? if ( $row->date <= strtotime("-30 days") ) { ?&gt;
                    <span style="color:red">
            &lt;? }
                else { ?&gt;
                    <span>
            &lt;?    } ?&gt; &lt;?=timespan($row->date)?&gt; ago</p>
            </div>&lt;!-- /date --&gt;

Great now that I have figured that part out lets make some post...

Wait a minute, kept saying "1 second ago" even though it was posted one minute ago...

So I went through my checklist and confirmed that the date was indeed being passed from as a unix time format, the date is being inserted into the database correctly... then I found it!

The posts have somehow generated 1.21 Gigawatts of power and hit 88 mph.. my post is in the future.

So the post was saying "1 second ago" because the date has not become a date in the past yet, even though it has passed... yeah too late for things like that. Turns out it was an issue with the local dev server, live server it runs fine.


-Lee


  Authlib and flashdata
Posted by: El Forum - 07-09-2007, 10:48 PM - Forum: Archived Development & Programming - No Replies

[eluser]schnoodles[/eluser]
Hello, i am currently using Authlib on my site and it works a treat, only problem is i find that when i use Db_session and set some flashdata and then in my header i do a

if ( flashdata ) echo flashdata

This works good but i found that when i go to some other pages it still keeps the flashdata without getting rid of it so i played around and i tried adding

&lt;?php $this->db_session->_flashdata_sweep(); ?&gt;

into my footer but this still didnt seem to sweep all the flashdata, does anyone know how i can clear the flashdata at the bottom of every page so none of it will transfer between pages.


  subtle gotcha using query bindings
Posted by: El Forum - 07-09-2007, 07:22 PM - Forum: Archived Development & Programming - Replies (1)

[eluser]Bacteria Man[/eluser]
I ran into one of those subtle gotchas that makes perfect sense once the reason for it is identified.

I have a query string which uses a single binding:

$sql = "SELECT DISTINCT(rp.permissions) FROM role r INNER JOIN role_permissions rp ON rp.role_id = r.role_id WHERE r.role_id IN (?)";

The query call looks like this:

$query = $this->db->query($sql, array('roles' => $roles));

...where $roles equals "2,3" (i.e. a comma delimited string with numeric values)

The problem is that CI (and properly so) escapes the string which produces:

SELECT DISTINCT(rp.permissions) FROM role r INNER JOIN role_permissions rp ON rp.role_id = r.role_id WHERE r.role_id IN ('2,3')

As a result MySQL interprets only the first value and drops any subsequent ones.

The obvious solution is to include the $roles variable inline as

$sql = "SELECT DISTINCT(rp.permissions) FROM role r INNER JOIN role_permissions rp ON rp.role_id = r.role_id WHERE r.role_id IN ($roles)";

Using a fixed number of question marks wasn't practical because the number of comma-delimited values can vary from query to query.

This is ordinarily not a good idea, but in this case the risk is minimal because there's no user-inputted data to contend with.

Perhaps this will save someone a little time.


  Include a extern php file...
Posted by: El Forum - 07-09-2007, 04:01 PM - Forum: Archived Development & Programming - Replies (3)

[eluser]Unknown[/eluser]
Hi..

I´m trying to include a extern php file, I received no error messages em I use this:
include(base_url().'public/includes/funcoes.php');
The path exists and the file is there!

but when I try to access a method function of the file 'funcoes.php' I got the php error:
Fatal error: Call to undefined function ConverteDataBR() in C:\projetos\web\ci\system\application\views\busca.php on line 32


Somebody can reply me?

Thanks...


  Autoloading database library on Windows causes silent CI failure
Posted by: El Forum - 07-09-2007, 02:44 PM - Forum: Archived Development & Programming - Replies (4)

[eluser]Bobtorious[/eluser]
Here's the thread over in the general discussion forums.

http://ellislab.com/forums/viewthread/56059/

Here's my addition to it:

I am, in fact, having this exact same problem. It appears to be platform specific though. This is only happening on Windows. The minute you go to add ‘database’ to the autoload[’libraries’] array in autoload.php, and try serving it on a Windows machine (I’m using Apache 2.2.4 for Windows, not sure about results on IIS), your CI app will fail to load, no errors, nothing logged anything! You just see a blank white page in your browser (the page doesn’t have any HTML source code either).

If you take this exact same CI setup and copy it over to a Linux machine, it works flawless. Sounds like a CI bug. I would really like to get this resolved.


  Setting Content type in header
Posted by: El Forum - 07-09-2007, 02:06 PM - Forum: Archived Development & Programming - Replies (2)

[eluser]pmonty[/eluser]
I am using this in my code:

Code:
$this->output->set_header("Content-type: text/xml");
//do some stuff and then
echo $xmlstream;

But gettng this in my headers (using an http analyzer to capture the http stream):
Code:
HTTP/1.1 200 OK
Server: Microsoft-IIS/5.0
Date: Mon, 09 Jul 2007 19:56:53 GMT
Connection: close
X-Powered-By: PHP/5.2.3
Content-type: text/html

Am I using the wrong syntax or something in my set_header command that anyone can see?

Paul


  Pagination on Random Result Set ?
Posted by: El Forum - 07-09-2007, 12:50 PM - Forum: Archived Development & Programming - Replies (5)

[eluser]chrisco23[/eluser]
Someone out there must be using the Pagination class on a randomly-ordered query result set?

Can anyone recommend a good way to go about this? An example maybe?

Do you do one query and keep all the results in some session variable?

Two things I need to make happen:

1. You click on a result, you click the back button, results are in same order.
2. You get a paginated list of results in a random order, but the order stays the same as you traverse the pagination.

I would think one method solves both problems just not sure what is best and know this must be a solved problem already.



Thanks,
Chris


  Automatic templating of text files within a directory (with caching)
Posted by: El Forum - 07-09-2007, 12:20 PM - Forum: Archived Development & Programming - Replies (11)

[eluser]BlkAngel[/eluser]
Greetings everyone!

I'm afraid that I require a little bit of assistance laying down the groundwork for a small personal project of mine. I'm basically trying to dive into PHP OOP, and I already did one small thing that works, so now I'm trying to make a little more ambitious project for myself.

Background: I have a lot of emails I want to save, and forgetting all the high-level Gmail stuff out there, what I have been doing for a while now is a simple copy/paste into text files in various subdirectories.

Synopsis:
I was thinking that should be possible to use Code Igniter for this task to build some experience using it (I tried playing with Zend Framework and for some reason the .htaccess stuff didn’t work out too well with calling the correct controller methods).

For the example, let’s say this is our directory structure:


Code:
/myTextFiles
  /sample1
  - a.txt
  - b.txt
  - c.txt
  /sample3
  - d.txt
  - e.txt
  - f.txt

What I would like to know is the best way to index and cache the contents of this directory, at least the filenames and hierarchy. For example, visiting the page responsible for showing the contents of the root directory (/myTextFiles in this case), I would expect to see:

sample1
sample2


Based on the directory names. Then following “sample1” link for example, I would get:

a
b
c


…allowing me to follow any of those links and see the contents of the corresponding .txt file in a templated page.

Problems I need to solve:
1) I don’t want to recurse down the directory tree every time a request comes in for /myTextFiles… if there are several hundred files in there, that is a lot of system calls just to display some links. Ideally, until something gets changed: a new file uploaded or some file deleted, I’d like to cache the directory structure in some way (DB perhaps). Does anyone know the groundwork of what might work best here, since this is somewhat uncharted territory for me at this moment? I have a feeling trees and parent/child relationships will be key here.

2) It would be easier to make it one directory level deep, but ideally I’d like to expand it for infinite recursion, so /myTextFiles -> DirectoryA -> DirectoryB ->… etc. as far as it needs to go (maybe an arbitrary limit designated by a constant or something).


I’d appreciate any suggestions or advice any of you might offer.



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