Jump to content

Frank Vèssia

Members
  • Posts

    584
  • Joined

  • Last visited

  • Days Won

    2

Everything posted by Frank Vèssia

  1. it's the same , the www part tell only using always the www domain to avoid duplicated contents but other behavior remain the same
  2. Done. ################################################################################################# # START PROCESSWIRE HTACCESS DIRECTIVES ################################################################################################# Options -Indexes Options +FollowSymLinks RewriteEngine On RewriteCond %{http_host} ^soddisfa [NC] RewriteRule ^(.*)$ http://www.soddisfa.com/$1 [R=301,L] Redirect /6-amicizie.html http://www.soddisfa.com/amicizie/ # ----------------------------------------------------------------------------------------------- # Access Restrictions: Keep web users out of ProcessWire system files # ----------------------------------------------------------------------------------------------- RewriteCond %{REQUEST_URI} (^|/)\.htaccess$ [NC,OR] RewriteCond %{REQUEST_URI} (^|/)site/assets/(cache|logs|backups|sessions|config|install)($|/.*$) [OR] RewriteCond %{REQUEST_URI} (^|/)site/install($|/.*$) [OR] RewriteCond %{REQUEST_URI} (^|/)(wire|site)/templates-admin($|/|/.*\.(php|html?|tpl|inc))$ [OR] RewriteCond %{REQUEST_URI} (^|/)site/templates($|/|/.*\.(php|html?|tpl|inc))$ [OR] RewriteCond %{REQUEST_URI} (^|/)site/assets($|/|/.*\.php)$ [OR] RewriteCond %{REQUEST_URI} (^|/)wire/(core|modules)/.*\.(php|inc|tpl|module)$ [OR] RewriteCond %{REQUEST_URI} (^|/)site/modules/.*\.(php|inc|tpl|module)$ [OR] RewriteCond %{REQUEST_URI} (^|/)(COPYRIGHT|INSTALL|README|htaccess)\.txt$ RewriteCond %{REQUEST_URI} (^|/)site-default/ RewriteRule ^.*$ - [F,L] # ----------------------------------------------------------------------------------------------- # Ensure that the URL follows the name-format specification required by ProcessWire # ----------------------------------------------------------------------------------------------- RewriteCond %{REQUEST_URI} "^[-_.a-zA-Z0-9/]*$" # ----------------------------------------------------------------------------------------------- # If the request is for a file or directory that physically exists on the server, # then don't give control to ProcessWire, and instead load the file # ----------------------------------------------------------------------------------------------- RewriteCond %{REQUEST_FILENAME} !-f RewriteCond %{REQUEST_FILENAME} !-d # ----------------------------------------------------------------------------------------------- # Pass control to ProcessWire if all the above directives allow us to this point. # ----------------------------------------------------------------------------------------------- RewriteRule ^(.*)$ index.php?it=$1 [L,QSA] ################################################################################################# # END PROCESSWIRE HTACCESS DIRECTIVES ################################################################################################# I'm not expert of htaccess code maybe some PW code here fails the redirect...
  3. I recreated a site using PW and i need to redirect some old urls to new but the rediret directive in .htaccess file is not working good, PW send me to 404 page and the url became www.mysite.com/new-page/?it=old-page.html
  4. @Ryan You are right but i'm fighting with my seo expert and he is also right about little improvements...He knows his job and in many years of work with him i have to admin that the results talk...look at this forum url... maybe some people don't like .html but if i can have little advantages from mr. G, i like too. About selectors, i will use the .html only to "final" pages, i mean pages that will never have children and that i will never use for selectors so this is not a problem like can be for categories (in my case).
  5. Good solution adding .html in the page name...
  6. That's great because i have lots of categories..thx
  7. Thanks for the suggests... hidden_path is the name of the folder where i store images. I save this parameters as a field in my page and when i displays it i know where the images are. Regarding the error i've found right now. I'm feel and idiot....it's the uppercase field Email....when the code checks mandatory fields before saving the page i wrote email and not Email... Sorry for this post.
  8. This is good..but it could be better when i choose "No" for this setting to add a custom end like .html o whatelse instead of a / ;D
  9. mmm, my last post with whole template has disappeared...but if a try to reply i can see it in replies queue...
  10. Mmmm, i tried to change the submit name with no luck.. This is my template, divided in two files, the code that save the page and the form included. insert-ad.php <?php $code = md5(uniqid(rand(), true)); $code = substr($code, 0, 10); require_once('functions.php'); if($input->post->submit_annuncio) { // create a new Page instance $p = new Page(); // set the template and parent (required) $p->template = $templates->get("annuncio"); $categoria = $input->post->categoria; $p->parent = $pages->get("/".$categoria."/"); // populate the page's fields with sanitized data // the page will sanitize it's own data, but this way no assumptions are made $p->hidden_path = $sanitizer->text($input->post->hidden_path); $p->title = $sanitizer->text($input->post->title); $p->nome = $sanitizer->text($input->post->nome); $p->Email = $sanitizer->email($input->post->Email); $p->citta = $sanitizer->text($input->post->citta); $provincia = $input->post->provincia; $p->provincia = $pages->get("/annunci/".$provincia."/"); $p->categoria = $pages->get("/".$categoria."/"); $p->testo = $sanitizer->textarea($input->post->testo); // PW2 requires a unique name field for pages with the same parent // make the name unique by combining the current timestamp with title $p->name = $sanitizer->pageName(rand(0,900)."-".tagliaUrl($p->title,50)); /* $p2 = new page(); $p2->template = $templates->get("citta"); $p2->parent = $input->post->provincia; $p2->title = $sanitizer->text($input->post->citta); $p2->name = $sanitizer->pageName(time() . $input->post->citta);*/ if($p->title && $p->email && $p->citta) { // our required fields are populated, so save the page // you might want to email it here too $p->save(); //$p2->save(); echo "<h2>Grazie, il tuo annunci é stato inserito.</h2>"; } else { // they missed a required field echo "<p class='error'>Errori nel form. Compila tutti i campi.</p>"; } } else { ?> <!DOCTYPE html> <html lang="it"> <head> <meta http-equiv="content-type" content="text/html; charset=utf-8" /> <title><?php echo $page->get("headline|title"); ?></title> <meta name="description" content="<?php echo $page->summary; ?>" /> <meta name="robots" content="noindex, nofollow" /> <link rel="stylesheet" type="text/css" href="<?php echo $config->urls->templates?>styles/main.css" /> <!--[if IE]> <link rel="stylesheet" type="text/css" href="<?php echo $config->urls->templates?>styles/ie.css" /> <![endif]--> <script type="text/javascript" src="<?php echo $config->urls->templates?>scripts/jquery-1.4.2.min.js"></script> <script type="text/javascript" src="<?php echo $config->urls->templates?>scripts/main.js"></script> <script type="text/javascript" src="<?php echo $config->urls->templates?>scripts/jquery.validate.min.js"></script> <script type="text/javascript" src="<?php echo $config->urls->templates?>scripts/jquery.metadata.js"></script> <script type="text/javascript"> function gotopage(page){ window.location = page; } </script> <link href="/uploadify/uploadify.css" type="text/css" rel="stylesheet" /> <script type="text/javascript" src="/uploadify/swfobject.js"></script> <script type="text/javascript" src="/uploadify/jquery.uploadify.v2.1.4.min.js"></script> <script type="text/javascript"> $(document).ready(function() { $('#file_upload').uploadify({ 'uploader' : '/uploadify/uploadify.swf', 'script' : '/uploadify/uploadify.php', 'cancelImg' : '/uploadify/cancel.png', 'folder' : '/photos/', 'buttonImg' : '/uploadify/button.jpg', 'width' : 135, 'fileExt' : '*.jpg;*.jpeg', 'multi' : true, 'queueSizeLimit' : 3, 'sizeLimit' : 307200, 'auto' : false, 'scriptData' : {'title':'<?=$code?>'}, 'onQueueFull' : function (event,queueSizeLimit) { alert("Non puoi inserire altre immagini"); return false; }, 'onAllComplete' : function(event,data) { alert('Immagini caricate. Ora clicca su Inserisci Annuncio'); } }); $("#form_annuncio").validate({ rules: { email: { required: true, email: true } }, messages: { email: "Inserisci una email valida" } }); $.metadata.setType("attr", "validate"); }); </script> </head> <body> <div id="container"> <div id="header"><a href="/"><img src="/site/templates/styles/images/logo.png" /></a></div> <? include('sidebar.inc'); ?> <div id="main"> <h2>Inserisci un annuncio gratuito</h2> <?php include("./nuovo-annuncio.inc"); ?> </div> <div id="clear"></div> </div><!-- container --> <div id="footer"> <div id="inside">© 2010-2011 MF Network s.r.o.</div> </div> </body> </html> <? } ?> nuovo-annuncio.inc <form action='/inserisci-annuncio/' method='post' id="form_annuncio" name="form_annuncio" enctype="multipart/form-data"> <input type="hidden" name="hidden_path" value="<?=$code?>" /> <p> <label id="etichetta">Nome</label> <input type='text' name='nome' class="required" /> </p> <p> <label id="etichetta">E-Mail</label> <input type='email' name='Email' id='Email' class="required" /> </p> <p> <label id="etichetta">Provincia</label> <?php $province = $pages->get("/annunci/")->children("sort=provincia_regione"); echo "<select name='provincia'><option value=''>Scegli la tua Provincia</option>"; $regione = ""; foreach($province as $provincia) { if ($regione == $provincia->provincia_regione){ echo "<option value='{$provincia->name}'> {$provincia->title}</option>"; }else{ echo "<option value='' disabled style='background-color:#dcdcc3;text-transform:uppercase'>{$provincia->provincia_regione}</option>"; echo "<option value='{$provincia->name}'> {$provincia->title}</option>"; } $regione = $provincia->provincia_regione; } echo "</select>"; ?> </p> <p> <label id="etichetta">Cittá</label> <input type='text' name='citta' class="required" /> </p> <p> <label id="etichetta">Categoria</label> <select name="categoria"> <? foreach ($pages->find("template=categoria") as $categoria) echo "<option value='{$categoria->name}'>{$categoria->title}</option>"; ?> </select> </p> <p> <label id="etichetta">Titolo</label> <input type="text" name='title' id="title" style="width:300px" class="required" /> </p> <p> <label id="etichetta">Annuncio</label> <textarea name='testo' cols="60" rows="6" class="required"></textarea> </p> <p> <label id="etichetta">Immagini</label> <div style="width:390px;float:left"><strong>Puoi inserire fino a 3 immagini .jpg di massimo 300 kb l'una.<br />Clicca sul bottone arancione per scegliere le tue immagini, dopo clicca su Carica Immagini.<br /></strong> <input type="file" id="file_upload" name="file_upload" /> <a class="carica" href="javascript:$('#file_upload').uploadifyUpload();">Carica Immagini</a> </div><div style="clear:both"></div> </p> <p> <input type='submit' name='submit_annuncio' value='Inserisci Annuncio' /> </p> </form>
  11. I'm using in my site a form that generated pages with form post fields. This worked good until i setup a comment system in all my pages. Now when i use my form the system get me error like there are some empty fileds in my form but i guess this error is referred to the comment form that is not set in this kind of page.
  12. My website is a classified website and every users (also guest) can add an ad with photo. So it's important to have a complete form with images uploader.
  13. yes, manually i can do this, but i hoped to reuse some good internal functions and not make this handmade...
  14. Yes, that's the point, security... but i really need this in my form...maybe for now i can save the field like a string using the name of the file and store the file with my own function in a folder on the server... :-\
  15. I have a form that stores data in db adding a page. It could be nice to add also a field image with the same behavior like the one in the admin, with maximum image uploaded and option for resize. Can i access to some internal functions for making this?
  16. ok it was only a suggest..be cool.
  17. I think guys it could be a nice thing to remove the "view" link from the edit page, it creates a sort of loop if someone click everytime this link...
  18. Ok now it works...but why you put the module in site instead of wire? I think it's not a good thing especially for updating PW i need to remember to keep this folder
  19. Not working for me...I've installed it but i cannot see the bar...
  20. I'm trying to make almost the same form but i need the parent page is not the same for all submissions but is choosen by user in the form. I created a field in my form with the name "category" and populated with some pages i created in admin. in the php code you wrote at this line: $p->parent = $pages->get("/form-results/"); i tried to make this: $p->parent = $input->post->category; With no luck... There is a way to obtain this?
  21. It works but obviously i need to create the fields in the db first. I think it's better to wait next updates of PW (i've read about new users management) before making serious modification with handmade code.
  22. Maybe could be nice if the users system will be connected with a customizable registration page, in this way we can create specific fields for users and have a right page for registering.
  23. This request is very important and i need it also for my project...
  24. Really nice work..hope to find this as module in next update of WP
×
×
  • Create New...