[PHP] XML manipulation

2009-03-03 Thread Raido

Hi!

Manipulating XML files with PHP is quite new thing to me, so I could 
need a bit help with it.

Here are the questions(and below are XML schema):
1) Is it possible to change those blocks order?
For example I move block number=1.1.1 below 1.1.3 and it's number 
gets changed from 1.1.1  1.1.3 and  1.1.2  1.1.1 and 1.1.3  1.1.2
I also should be able to change order of blocks with number=1.1 (for 
example 1.1  1.8 and 1.8  1.1)  and number=1.


2) where and how should I approach?
Theoretically I think I should make a html list from the blocks and make 
it sortable with help of jQuery... beginning doesn't seem so 
difficult..but what happends then? (SimpleXML havent helped me with 
changing order..it helps me to change and read attributes.)



So any suggestions/ideas for completing that kind of solution are welcome.


And here is the XML (simplified)structure:

--
block number=1 text=main of the all blocks
   block number=1.1
   block number=1.1.1
   somestuff_here text=hello/somestuff_here
   /block
   block number=1.1.2
   someotherstuff_here text=hello again/someotherstuff_here
   /block
   block number=1.1.3
   
   /block
   /block
   block number=1.2
   
   /block
/block

--



Thank you for help.

Raido

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] Creating new site

2008-07-31 Thread Raido
I have investigated some frameworks.. Zend and Codeiginiter but I 
haven't done any testing/exercises. They seem to make things much more 
simple/faster yes...but I'm not sure how much time it will take to get 
know one of them(or CakePHP). And I haven't got into reading 
licences...I'm sure they have got licences that restricts something(or 
not ?) To be honest, I kinda hate all kind of licences. There are many 
pages info what I can and what I can't do...but I mostly like to do what 
I have and want to do. Also, inventing the wheel once, might give good 
experience or am I going slippery way ?




Shawn McKenzie wrote:

Micah Gersten wrote:

Depending on the size of the site, you might want to consider a PHP
framework to start with.  There's usually no point in reinventing the
wheel.  Someone mentioned CakePHP which utilizes MVC.  I'm looking into
porting my stuff to the Zend Framework which makes MVC optional, but has
a lot of functionality make available.

Thank you,
Micah Gersten
onShore Networks
Internal Developer
http://www.onshore.com



I too like CakePHP.  I have coded in PHP for quite a while and 
understand OOP and OOP in PHP, however I don't really have any 
experience building sites or apps from scratch using OOP/MVC.


Cake or a framework makes it much quicker and easier. For those that 
need total freedom to do things the way they want but need some 
pre-built functionality to make it quicker, Zend seems to be the choice. 
 I consider Zend to be more of a class library like PEAR only more 
consistant.  For me, I had no habits/best practices or preferred way 
when I started with OOP/MVC so Cake was great.  It has a certain 
structure and uses certain conventions and code generation which makes 
it very quick and easy.  The main drawback is the docs.


-Shawn




Raido wrote:

Hi,

There are many sites explaining how to build new site etc but I'd like
to hear what You suggest. (about how to plan whole thing and how to
write separate parts which can be put together later)

I have build many small sites for myself(site to organise class
assembly which is like yearly convention..it has user administration
etc) but they all are anything else than OOP. But now, I need to help
with creating one bigger site which should be OOP. That site should
include user management(each user has it's own profile), each user can
post job and other adds in different categories. (there will be many
categories for example 'work,cars,training,apartments'.)
And users profile should show ads posted by himself.
Logic itself is simple:
1) unregistered user:
a) I go to site, I see categories (work offers, apartment offers,
training offers, etc)
b) I click on category I'm interested in
c) I see ad that I'm interested in
d) I click on it
c) I see detailed information about it(which company posted it etc)
d) at bottom page I see form where I can contact with ad author
2) registered user
a) I go to site
b) I log in, my profile page opens
c) there I can see ads posted by me..also I can see how many times
ad is viewed etc
d) i click on link 'Post new ad'
e) there i choose category and probably Ajax helps to load
specific fields(for example if I choose 'Cars' as category, then
fields like  'year,transmission,color, etc' will appear.

That is short summary what that site should do. It seems quite big for
me so I'd be happy to hear any guidelines from people who have built
big sites.

Creating forms, posting data, user login etc, these things are not
problem... problem is: how to build the whole thing aimed to OOP and
use with Smarty to keep things organized.

I'm not sure but I have idea about what things I should do first:

1) think and write down any function that needs to be done(for example
different validations, functions for showing/posting form etc)
2) plan and create database?
3) create database class which handles database connection
But what next? Or am I starting all wrong?

Big thanks in advance,


Raido





--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



[PHP] Creating new site

2008-07-30 Thread Raido

Hi,

There are many sites explaining how to build new site etc but I'd like 
to hear what You suggest. (about how to plan whole thing and how to 
write separate parts which can be put together later)


I have build many small sites for myself(site to organise class assembly 
which is like yearly convention..it has user administration etc) but 
they all are anything else than OOP. But now, I need to help with 
creating one bigger site which should be OOP. That site should include 
user management(each user has it's own profile), each user can post job 
and other adds in different categories. (there will be many categories 
for example 'work,cars,training,apartments'.)

And users profile should show ads posted by himself.
Logic itself is simple:
1) unregistered user:
	a) I go to site, I see categories (work offers, apartment offers, 
training offers, etc)

b) I click on category I'm interested in
c) I see ad that I'm interested in
d) I click on it
c) I see detailed information about it(which company posted it etc)
d) at bottom page I see form where I can contact with ad author
2) registered user
a) I go to site
b) I log in, my profile page opens
	c) there I can see ads posted by me..also I can see how many times ad 
is viewed etc

d) i click on link 'Post new ad'
	e) there i choose category and probably Ajax helps to load specific 
fields(for example if I choose 'Cars' as category, then fields like 	 
'year,transmission,color, etc' will appear.


That is short summary what that site should do. It seems quite big for 
me so I'd be happy to hear any guidelines from people who have built big 
sites.


Creating forms, posting data, user login etc, these things are not 
problem... problem is: how to build the whole thing aimed to OOP and use 
with Smarty to keep things organized.


I'm not sure but I have idea about what things I should do first:

1) think and write down any function that needs to be done(for example 
different validations, functions for showing/posting form etc)

2) plan and create database?
3) create database class which handles database connection
But what next? Or am I starting all wrong?

Big thanks in advance,


Raido



--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] uploading big files with PHP

2008-07-25 Thread Raido

Hi,

Maybe this is involved with it ?
http://ee.php.net/manual/en/info.configuration.php#ini.max-input-time




Angelo Zanetti wrote:

Hi all

We are pitching to develop a website where the admin has to upload big video
files but I'm not sure how this can be done as the file upload will most
probably time out.

How do current websites do it? Is there somehow a way to make use of FTP to
transfer the files?

Any links, help, advice will be appreciated.

Thanks in advance

Angelo
http://www.elemental.co.za




  



--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



[PHP] Getting info from SVN commit with php

2008-07-23 Thread Raido

Hi,

I would be very grateful if someone could point out some ways how to do 
the following:


I have an SVN server but I need to add some extra to commit message 
which PHP will get  and use(for example use the parameters from commit 
message to change data on mysql database... (if commit messages first 
line has character *, then run sql query... update tasks set 
some_row='OK' where

Currently important is:
1) Is it even possible to get commit messages text with php ? Since I 
can't find the file where commit messages are.

I only digged subversion docs for 'how to edit message'

Should, be possible(bot nut sure) to use commands: 
$ svn propedit -r N --revprop svn:log URL

$ svn propset -r N --revprop svn:log new log message URL

What I'd like to achieve is:
I'l' make page where I store all my tasks (for example Need to add login function 
to test.php). In MySQL, this task has got ID 1 and STATUS 0 which means it isn't 
done yet.

Then when I have that task done I start writing commit message where first line 
may look like this: 1|1
and rest of the lines will be regular commit message. Then there will be PHP 
script which checks that commit message and reads that line where I put 1|1 and 
understands that first number is task ID and second is STATUS and then run sql 
query like:
update tasks set STATUS=1 where ID=1;

So, seems impossible? For me, currently yes, since I haven't found any examples 
how to do it...but I know that nothing is impossible.

Raido



--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] Getting info from SVN commit with php

2008-07-23 Thread Raido

Thank You for that fast reply.

PECL was something that I din't know about. But I'll dig in with Your 
examples and also PECL and try to find most simple but well-working 
solution.

Also sorry for Return Receipt, turned that off.


mike wrote:

On 7/23/08, Raido [EMAIL PROTECTED] wrote:

  

I have an SVN server but I need to add some extra to commit message which
PHP will get  and use(for example use the parameters from commit message to
change data on mysql database... (if commit messages first line has
character *, then run sql query... update tasks set some_row='OK'
where



There's an SVN PECL module: http://pecl.php.net/package/svn

Also, you can easily run these kind of commands via system() - I've
done that in the past, but now that there's this SVN PECL module I've
been wanting to get aligned that way. Always better in my opinion to
use APIs and not system() calls.

If the svn module doesn't meet your needs you can ask for
enhancements, or just use system() for now.

here's a couple functions I wrote.
$config['svn'] was the path to the svn command (like /usr/bin/svn)

i used the xml output option so i could parse it using simplexml.
also, i pass it a username, password and repository since i support
multiple repositories and each one has a unique username/password set.
it worked like a charm. i am sure you can tailor this code to suit
your needs.

# get the latest revision #
function svn_latest($username, $password, $repository) {
$xml = simplexml_load_string(shell_exec($GLOBALS['config']['svn'].
info --xml --non-interactive --no-auth-cache --username {$username}
--password{$password} svn://localhost/{$repository}));
return intval($xml-entry-commit['revision']);
}

function svn_history($username, $password, $repository, $count = 20,
$start = 0, $latest = 0) {
# svn's revisions are incremental, so we need to calculate
backwards to find the right offsets
if($latest == 0) {
$latest = svn_latest($username, $password, $repository);
}
$start = $latest - $start;
$end = intval($start - $count) + 1;
if($end  0) { $end = 0; }
$xml = simplexml_load_string(shell_exec($GLOBALS['config']['svn'].
log --xml --non-interactive --no-auth-cache --username {$username}
--password {$password} -r {$start}:{$end}
svn://localhost/{$repository}));
return $xml;
}

  



--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php