1
CiberEspia
create a directory

I need to create a directory in my host for each user, I am trying it with (in theme.html):
<{php}>
$ruta '/home/proinsa/public_html/$xoops_uname;
mkdir($ruta, 0700);
<{/php}>

but the variable $xoops_uname does not work to me.

somebody can help me!!
Mario Burga
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
>>Adictoshp.org|Web Blog<<
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

2
Will_H
Re: create a directory
  • 2006/11/8 21:33

  • Will_H

  • Friend of XOOPS

  • Posts: 1786

  • Since: 2004/10/10


Smarty tags required.

<{$xoops_uname}>

3
CiberEspia
Re: create a directory

it does not work in my theme.
<{php}>
$ruta '/home/proinsa/public_html/<{$xoops_uname}>';
mkdir($ruta0700);
echo 
$ruta;
<{/
php}>
DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<
html xmlns="http://www.w3.org/1999/xhtml" xml:lang="<{$xoops_langcode}>" lang="<{$xoops_langcode}>">
<
head>


I print (echo $ruta;)and obtain : /home/proinsa/public_html/<{$xoops_uname}>
Mario Burga
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
>>Adictoshp.org|Web Blog<<
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

4
Will_H
Re: create a directory
  • 2006/11/8 21:56

  • Will_H

  • Friend of XOOPS

  • Posts: 1786

  • Since: 2004/10/10


Why are you tracing it down to root?

couldnt you use <{$xoops_url}><{$xoops_uname}>

5
m0nty
Re: create a directory
  • 2006/11/8 21:59

  • m0nty

  • XOOPS is my life!

  • Posts: 3337

  • Since: 2003/10/24


the only problem with that method is, even if it does work, it's gonna keep trying to create the directory everytime the page is refreshed.

what you should do is add the mkdir into the registration/activation script so that it only tries to create it once on registration or activation.

you should try to avoid at all costs using php in theme.html, try to seperate code from output for better practice and optimization.

6
CiberEspia
Re: create a directory

which would be the code to add in the register???


Quote:
couldnt you use <{$xoops_url}><{$xoops_uname}>



the important thing is to obtain the user name so that the route I can obtain it from XOOPS_ROOT_PATH.

smarty does not work within <{php}> (there my problem)
Mario Burga
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
>>Adictoshp.org|Web Blog<<
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

7
m0nty
Re: create a directory
  • 2006/11/8 22:33

  • m0nty

  • XOOPS is my life!

  • Posts: 3337

  • Since: 2003/10/24


well in the php code itself, it's quite different.

roughly (it all depends on where you place the code as you may need to also grab the uid aswell if it's not already defined in the script where you place the code)

$username xoops_getLinkedUnameFromId($this->getVar('uid'));


and that all depends on if uid is defined from an object.

again tho, in registration, you might not even need that as if you place the code in the right place, you could get the uname straight from the $_POST['uname'] data that the user submitted.

8
m0nty
Re: create a directory
  • 2006/11/8 22:47

  • m0nty

  • XOOPS is my life!

  • Posts: 3337

  • Since: 2003/10/24


in register.php

you could add it no probs.. (i'm still unsure as to why you want to do this though)

find in register.php

$newuser->setVar('user_mailok',$user_mailoktrue);


add right after:

$ruta XOOPS_ROOT_PATH.'/'.$newuser->getVar('uname');
mkdir($ruta0700);


and that should i think, create a directory upon completion of registration.

i should add some error checking into that tho, to check if the folder exists 1st before trying to create it.

Login

Who's Online

273 user(s) are online (200 user(s) are browsing Support Forums)


Members: 0


Guests: 273


more...

Donat-O-Meter

Stats
Goal: $100.00
Due Date: Nov 30
Gross Amount: $0.00
Net Balance: $0.00
Left to go: $100.00
Make donations with PayPal!

Latest GitHub Commits