logs archiveIRC Archive / Freenode / #php / 2006 / April / 4 / 1
kennebel
existance: where i used to work, i had my own linux box, integrated with the rest of the windows network. at my new job i'm still wearing them down. :)
tempest1
bashusr: it doesn't, you have to code around it i think
kennebel
bashusr: if you break normal, you exit the inner most. If you do a break 2;, you'll break out of the outer one.
existance
kennebel, haha, gl.
Dragnslcr
bashusr- if you want to break out of both loops from within the inner loop, you can use break 2
Mortis_kruuul
hi! http://www.muzyka.oz.pl :)
bashusr
thanks...
while i'm on the topic, is there anything to exit if statements?
Dragnslcr
If break doesn't work, no
kennebel
break will not work. No direct method.
         

bashusr
Dragnslcr: according to the manual, break is only for "for, foreach, while, do-while or switch"
that's when i wish i was coding VB and had that exitif function :-P
(Action) hides from the flames...
Dragnslcr
Heh
You should be able to work around it by using else
bashusr
Dragnslcr: i _could_
JohnnyL
anyone looking for extra help on their php projects?
Stormchaser
no
bashusr
but sometimes, you just want to exit the if statement if something ends up true
Dragnslcr
JohnnyL- I think that's why people come here...
Stormchaser
!+g7
php-bot
Guideline #7) No spam, bots, scripts, trolls, job postings (no job posting / asking for jobs on ##php. You might want to check out: ##php.jobs http://www.geekfinder.com, http://www.monster.com, http://www.rentacoder.com or http://www.getacoder.com, or php.net/links, "Developers and Job Opportunities"), advertisements or onjoin/away/back messages.
JohnnyL
oh
sorry.
Dragnslcr
You forgot www.screwacoder.com
JohnnyL
Dragnslcr, i feel ya.
leo037
hi all !
Tarantulafudge
how can I make a variable contain executable php code?
TML
JohnnyL: Don't be sorry. But in the future, make sure to read channel topics when you join.
Cheez
Tarantulafudge www.php.net/eval
but it's not nice :(
Stormchaser
o.O
Tarantulafudge
Cheez: why
leo037
Tarantulafudge: $var = 'echo "hello";'
Stormchaser
!+eval
         

php-bot
If eval() is the answer, you're almost certainly asking the wrong question. -- Rasmus Lerdorf, BDFL of PHP
JohnnyL
ok
leo037
:D
Cheez
ahh so that's who said it originally
i did wonder
Tarantulafudge
I'm trying to parse some templates but they have phpcode in them I still want to use
Dragnslcr
I've found exactly one good use eval, and that's debugging running scripts
masquerade
Dragnslcr: still sounds like a bad use to me
leo037
Tarantulafudge: $var = 'echo "hello";' ; eval($var);
Cheez
why not just include them? php IS technically a templating engine after all
Tarantulafudge
all I can think of is to echo it to a file and re-including it, but that would add a bit of overhead
Dragnslcr
I can't think of any other reason you'd ever need it
TML
I found one once, but I've forgotten it, and have never seen it a second time.
Tarantulafudge
Cheez: cause it needs to be parsed
TML
Tarantulafudge: Is this a one-time process, or something you want to do on the fly?
Dragnslcr
masquerade- well, it's pretty much the only way to check variables at run time
Tarantulafudge
TML: on the fly
itrebal
grr... simpleXML is a bi**h sometimes
TML
Tarantulafudge: Generally, allowing arbitrary PHP code in a template is discouraged.
Dragnslcr
Tarantulafudge- how are you getting the code in the first place?
masquerade
Dragnslcr: what's wrong with xdebug, debug_zval_dump, debug_backtrace, and various other debugging extensions
SethR
tml, my php.ini apparently was renamed php.ini.rpmnew .. and there is no php.ini even though phpinfo() says gives a path /etc/php.ini ... might that be a problem for the pear ?
TML
itrebal: As long as it's YOUR bi**h. :)
SethR: If php.ini isn't where phpinfo() says it is, it shouldn't be reading any php.ini at all, which makes your problem quite mysterious indeed.
Dragnslcr
masquerade- haven't really tried any external programs
itrebal
TML: oh i wish it was.... its not following my directions, i guess i let my pimp hand get weak
captbunzo
I don't know if anyone here can help me with this, but http://smarty.php.net seems to be down right now.
TML
SethR: You'll need to provide more details, such as precise wording of error messages.
captbunzo
I've checked the #smarty channel, but noone is there.
Dragnslcr
debug_backtrace, of course, would be a pain in the ass to write handlers for every possible variable
Tarantulafudge
Dragnslcr: Ok, I have a main template file with comments, and page files with comments, I'm going to use php to parse both and merge them together where the comments are (like title, and merge it with the template) to be eventually outputted, but the only problem is having php in the template
SethR
tml: here is one PHP Warning: Function registration failed - duplicate name - odbc_pconnect in Unknown on line 0
PHP Warning: Function registration failed - duplicate name - odbc_prepare in Unknown on line 0
TML
captbunzo: Thanks for pointing it out. I'll page the server admins.
SethR
but there are many many of them
captbunzo
thank you, TML.
TML
SethR: Are they all "odbc_<something>"?
Dragnslcr
Tarantulafudge- well, you could put include calls for the secondary data inside the main file, then just include it
captbunzo
are there any alternative download sites for smarty, that you are aware of?
leo037
i'm writing a blog engine, and i want to add comments : do I need a database ? I would like to use xml files, but if two comments come at the same time, i could have a problem, couldn't I ?
Dragnslcr
leo037- you don't have to use a database, but it's probably the best way
Tarantulafudge
Dragnslcr: secondary data inside the file? wouldn't that still be parsing? or is there something i'm not seeing
masquerade
leo037: a database is probably better than XML, but let me point out that you are reinventing 10,000 wheels
TML
captbunzo: You can check it out of CVS
Dragnslcr
Tarantulafudge- instead of trying to parse the files and merge them, just put stuff like <?php include('someotherfile.php'); ?> in the files
TML
captbunzo: The tree name is simply "smarty"
SethR
tml, no there are several kinds .. some are about mysql and some about ldap
leo037
Dragnslcr: how can I handle simultaneity ?
Tarantulafudge
Dragnslcr: I can't because these files work one way and thats the way the clients output the pages
Dragnslcr
leo037- any decent database system should handle it for you
TML
SethR: Very mysterious indeed. You're sure you've checked to right phpinfo()? E.g., the commandline and apache versions of PHP can look in different places for config files.
captbunzo
TML:ok. thanks
OzzY
hello peeps
TML
captbunzo: You'll probably want something akin to the following: cvs -d :pserver:cvsread@cvs.php.net:/repository co -r Smarty_2_6_9 smarty
leo037
Dragnslcr: but if I need to use XML, can I handle simultaneity ?
stoffus
I have this problem with my upload script ( Code: www.stoffus.com/scripts/upload.txt , page: www.stoffus.com/?page=upload&sub=upload ), which seems to return blank when I try to upload files bigger than the $max_filesize. Someone take a look? :)
kennebel
leo037: You could have a flat file XML system, but you are going to be coding for weeks handling all of the problems that an almost default install of the free MySQL will solve.
OzzY
I have mysql question if anyone could help
I have a table with an auto increment value
Dragnslcr
leo037- you can, but it would be a pain. Probably need to use file locks and such
Tarantulafudge
Dragnslcr: and since clients can't see the end result of the page of an included file, its out of the question
Dragnslcr: they couldn't see the files before they were published
OzzY
if I write a record to this table in php, can I get what the value is set to?
SethR
tml, here is my phpinfo http://speaktomecatalog.com/db/phpinfo.php
leo037
Dragnslcr: so, I'd better to use sqlite ?
Dragnslcr
OzzY- what database?
OzzY
mysql
Dragnslcr
leo037- yeah, you can use SQLite
fmz
OzzY, mysql_insert_id
Dragnslcr
SQLite should handle file locking
TML
SethR: Aren't you running into the problem when trying install something from pear?
SethR
tml: yes
TML
SethR: So showing me apache's phpinfo() isn't helpful in the least, as I've already mentioned.
OzzY
basically I hjave a table with two fields: one is an auto incrmemnt int, the other is a string. I want to add a new record, specifying the string and somehow get what tjhe int was set to?
masquerade
OzzY: php.net/mysql_insert_id
TML
SethR: PEAR uses the CLI version of php installed on your system , which in nearly all cases has a different configuration than apache.
Tarantulafudge
Dragnslcr: I have a designer that is VERY good at doing what he does, but hes doing it for free and I'm not looking to piss him off just because I want it done one way.. this is easier for the both of us.
SethR
tml: ok so where should i look?
OzzY
fmz: perfect, thanks :-)
TML
SethR: php.net/features.command-line
Tarantulafudge
Dragnslcr: you there?
TML
Jymmm: What did I miss?
Tarantulafudge
Is there a way to treat a variable as an included file?
TML
Tarantulafudge: include $var;
Jymmm
TML Just was cleaning up my +q and +b is all.
Tarantulafudge
TML: wouldn't that just look for the file to include in the var?
Jymmm
TML: "Kennedy was shot!" =)
Tarantulafudge
TML: hello?
mfonda
Tarantulafudge, including a file means all of the code in that file will be parsed. You can load the contents of a file into a variable by doing something like $var = file_get_contents('file');, but that isnt the same as including it
Tarantulafudge
mfonda: but you can't treat the file as if it was included?
mfonda: i mean the variable*
mfonda
Tarantulafudge, you've lost mean, I really don't understand what you are asking
s/mean/me/
Tarantulafudge
mfonda: I want to load a file into a variable, parse it myself, then treat the variable as the contents of an included file so the php within it can be executed
rift
dumb question, but something like: if (!$arr_foo = my_function()) {...} will only work if my_function() returns false, correct? so $arr_foo === false, but the if statement will recognize this?
r0xoR
erm
m_2925987
rift, (!($arr_foo = my_function()))
mfonda
Tarantulafudge, that is absolutely pointless. just include the file with include. unless you can tell me some reason why that wont work
Tarantulafudge
mfonda: because I can't parse it beforehand
mfonda
Tarantulafudge, then dont include it beforehand, include it later
SethR
tml: so how do i find where the php.ini file is for the command line?
itrebal
foreach($xml->elem as $c){ $page[$c['refid']] = $c['attr']; } that is the code looping over the elements on my XML file (using SimpleXML) and http://oviedo.itrebal.com/xml.php is the output of it (i print_r'd most things) and i cannot for the life of me figure out WHY its bi**hing at me, any ideas?
Tarantulafudge
mfonda: but how do I modify the contents of the page BEFORE it gets parsed by php to evaluate it like an include
jirwin
hey there
Discord
hola
mfonda
Tarantulafudge, I really have no clue what you ask or why, but there is a function eval() which parses code, but I would recommend NOT using it, and reconsider what you need to do
Tarantulafudge
mfonda: pm?
mfonda
sure
jirwin
is there a php function that will remove spaces around a character
I want to remove spaces around a comma
itrebal
str_replace?
jirwin
it would probably be a regex?
itrebal
preg_replace ?
jirwin
well, i don't want all spaces
TML
SethR: php.net/features.commandline
kennebel
jirwin: trim();
« prev 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 next »