Jump to content

Search the Community

Showing results for tags 'path'.

  • Search By Tags

    Type tags separated by commas.
  • Search By Author

Content Type


  • Welcome to ProcessWire
    • News & Announcements
    • Showcase
    • Wishlist & Roadmap
  • Community Support
    • Getting Started
    • Tutorials
    • FAQs
    • General Support
    • API & Templates
    • Modules/Plugins
    • Themes and Profiles
    • Multi-Language Support
    • Security
    • Jobs
  • Off Topic
    • Pub
    • Dev Talk

Product Groups

  • Form Builder
  • ProFields
  • ProCache
  • ProMailer
  • Login Register Pro
  • ProDrafts
  • ListerPro
  • ProDevTools
  • Likes
  • Custom Development

Find results in...

Find results that contain...

Date Created

  • Start


Last Updated

  • Start


Filter by number of...


  • Start





Website URL







Found 11 results

  1. A new module that hasn't had a lot of testing yet. Please do your own testing before deploying on any production website. Custom Paths Allows any page to have a custom path/URL. Note: Custom Paths is incompatible with the core LanguageSupportPageNames module. I have no experience working with LanguageSupportPageNames or multi-language sites in general so I'm not in a position to work out if a fix is possible. If anyone with multi-language experience can contribute a fix it would be much appreciated! Screenshot Usage The module creates a field named custom_path on install. Add the custom_path field to the template of any page you want to set a custom path for. Whatever path is entered into this field determines the path and URL of the page ($page->path and $page->url). Page numbers and URL segments are supported if these are enabled for the template, and previous custom paths are managed by PagePathHistory if that module is installed. The custom_path field appears on the Settings tab in Page Edit by default but there is an option in the module configuration to disable this if you want to position the field among the other template fields. If the custom_path field is populated for a page it should be a path that is relative to the site root and that starts with a forward slash. The module prevents the same custom path being set for more than one page. The custom_path value takes precedence over any ProcessWire path. You can even override the Home page by setting a custom path of "/" for a page. It is highly recommended to set access controls on the custom_path field so that only privileged roles can edit it: superuser-only is recommended. It is up to the user to set and maintain suitable custom paths for any pages where the module is in use. Make sure your custom paths are compatible with ProcessWire's $config and .htaccess settings, and if you are basing the custom path on the names of parent pages you will probably want to have a strategy for updating custom paths if parent pages are renamed or moved. Example hooks to Pages::saveReady You might want to use a Pages::saveReady hook to automatically set the custom path for some pages. Below are a couple of examples. 1. In this example the start of the custom path is fixed but the end of the path will update dynamically according to the name of the page: $pages->addHookAfter('saveReady', function(HookEvent $event) { $page = $event->arguments(0); if($page->template == 'my_template') { $page->custom_path = "/some-custom/path-segments/$page->name/"; } }); 2. The Custom Paths module adds a new Page::realPath method/property that can be used to get the "real" ProcessWire path to a page that might have a custom path set. In this example the custom path for news items is derived from the real ProcessWire path but a parent named "news-items" is removed: $pages->addHookAfter('saveReady', function(HookEvent $event) { $page = $event->arguments(0); if($page->template == 'news_item') { $page->custom_path = str_replace('/news-items/', '/', $page->realPath); } }); Caveats The custom paths will be used automatically for links created in CKEditor fields, but if you have the "link abstraction" option enabled for CKEditor fields (Details > Markup/HTML (Content Type) > HTML Options) then you will see notices from MarkupQA warning you that it is unable to resolve the links. Installation Install the Custom Paths module. Uninstallation The custom_path field is not automatically deleted when the module is uninstalled. You can delete it manually if the field is no longer needed. https://github.com/Toutouwai/CustomPaths https://modules.processwire.com/modules/custom-paths/
  2. Hi, I am trying (wondering if even possible) to set a very different file folder path for my PW install. The path I want to set exist in the same server, but in another domain. Can the PW API see that far into file system? It is a shared hosting environment so no permission management options available. Also can this be achieved through .htaccess redirection? If you request a file (images mostly, but translation json files are important too) from `domain-A.com/site/assets/files/` to grab them from `domain-B.com/site/assets/files/`? I would prefer to do this through PW API, I can see the function `$config->setPath()` but it didn't work when set in config.php like `$config->setPath("files", "/domains/domain-B/public_html/site/assets/files/")`. Is there some other option to do this? My ultimate goal is to have two PW installs on different domains but one is just a "mirror" that is using the same database as the other and should use the same files structure if editors upload any images to the main (domain-B.com) website. I could use domain parking function but it then needs a more expensive SSL certificate for two domains , which I am trying to avoid if possible ? (I'd like to use single domain Let's Encrypt certificates, thus I need to PW installs). Would appreciate any insight! Thanks!
  3. Hi Guys, Right now, I am using parents as breadcrumbs but I have pages under a parent page just to keep things organized. The pages are called in other areas of the site. I am trying to create user path history breadcrumbs. Meaning: If the user clicked a link to the page, it will show the path he took. Has anyone done this? Would love to see who has before I dive in. Thanks.
  4. Hello, I discovered processwire a couple of days ago and I am very impressed so now I am integrating it with the Yii framework (once complete I'll post a tutorial with code), so far it is going well but I do seem to have a problem with setting a new path for a $page->template->filename. Setting $config->paths->templates in the PW config.php file works fine but I want to be able to set Yii-specific config variables after I have included the PW index.php. I assumed that by setting $wire->config->paths->templates that this would be reflected in $page->template->filename but that doesn't seem to be the case. Is this a bug or am I confused? Any advice greatly appreciated.
  5. Hi, i need some help with a login script that im trying to implement under PW. When im enter the protectedpage.php it goes to login.php and then i fill in username/password and press login it just refreshes the login.php again and the input fields are empty. It should go to protectedpage.php after that but its not working. I think that there is a path och paths in the script that its wrong. All files are in the root of the template folder and i have a database table that im trying to fetch. I have also added the pages as templates in admin. If you see anything wrong with this please help. /thanks protectedpage.php <?php session_start(); require_once('config.php'); //phpinfo(); if(isset($_SESSION['id'])){ ?> <!doctype html> <html lang="sv-se"> <head> </head> <body> Lorem ipsum sit dolor amet. </body> </html> <?php } else{ header( "Location:../protectedpage"); } ?> login.php <?php session_start(); require_once( 'config.php' ); if ( isset( $_SESSION[ 'id' ] ) ) { header( "Location:protectedpage.php" ); } else { ?> <!DOCTYPE html> <html> <head> <title>Logga in</title> <link rel="stylesheet" href="<?=$config->urls->templates;?>css/login.css"> <script type="text/javascript" src="<?=$config->urls->templates;?>js/login.js"></script> </head> <body style="background-color:#bdc3c7"> <div id="main-wrapper"> <center> <h2>Logga in</h2> </center> <form action="../login" method="post" onsubmit="return validate(this);"> <div class="inner_container"> <div class="formgroup"><label class="lable-side"><b>Epost</b></label> <input type="text" class="text-side" name="email" id="email" value="<?php if(isset($_POST['login'])) { echo $_POST['email']; } else{ } ?>" autofocus> </div> <div class="formgroup"><label class="lable-side"><b>Lösenord</b></label> <input type="password" id="password" class="text-side" name="password"> </div> <div class="btngrp"><button class="login_button" name="login" type="submit">Login</button> <button type="reset" class="reset_btn">Återställ</button> </div> <div class="register_div"><a href="../register" class="register_link"><span>Registrera ny användare</span></a> </div> </div> </form> <?php if ( isset( $_POST[ 'login' ] ) ) { $email = $_POST[ 'email' ]; $password = $_POST[ 'password' ]; $query = $con->prepare( "select * from users where email=?" ); $query->bind_param( 's', $email ); $query->execute(); $result = $query->get_result(); $row = $result->fetch_assoc(); $hash_pwd = $row[ 'password' ]; $hash = password_verify( $password, $hash_pwd ); if ( $hash == 0 ) { echo '<script type="text/javascript">alert("Invalid Credentials")</script>'; } else { $query = $con->prepare( "select * from users where email='$email' and password=? " ); $query->bind_param( 's', $hash_pwd ); $query->execute(); $query_run = $query->get_result(); //echo mysql_num_rows($query_run); if ( $query_run ) { if ( mysqli_num_rows( $query_run ) > 0 ) { $row = mysqli_fetch_array( $query_run, MYSQLI_ASSOC ); $_SESSION[ 'email' ] = $row[ 'email' ]; $_SESSION[ 'id' ] = $row[ 'id' ]; header( "Location:../protectedpage" ); } else { echo '<script type="text/javascript">alert("No such Email exists. Invalid Credentials")</script>'; } } else { echo '<script type="text/javascript">alert("Database Error")</script>'; } } } else {} ?> </div> </body> </html> <?php } ?> config.php <?php $con = mysqli_connect( "localhost", "root", "htf43434" )or die( 'Database connect ' . mysql_error() ); mysqli_select_db( $con, 'ksf' ); ?>
  6. Hi, still amazed by the possibilities of Inputfield Dependencies, but haven't quite figured out how to use it: There's pages in different paths: HomeNobel prizeLiterature2012Page 1 Page 2 ... Economics2012 2011Page 1 Page 2 ... Yeah, I know, this structure doesn't make much sense at first sight. But trust me, it's elaborated. ;-) Now I've used one single template for Page 1, Page 2, etc. and it needs to be all the same. Only the field "topic" is different: I need it to be shown for pages in /nobel-prize/literature/..., but hidden for all other pages (like the ones in /nobel-prize/economics/...). So I put path%='literature' as a "Show this field only if"-condition. Doesn't work. What did I misunderstand? Thanks a lot Sarah
  7. Hello, it's very hard for me to describe the actual problem so I've attached two screenshots that contain all the required information. Basicly I'm trying to manipulate the page title that is rendered to the select field options within the page lister when setting up a filter using a PageField. (It's tedious to select the page you really want on duplicate titles) I can't find any solution to this problem. It doesnt seem to be as simple as hooking onto a render or textformat method. (Many attempts, no success ...) Please, can anyone help me out on this one?
  8. Hello, I have a PHP script being called by AJAX request. At this moment everything work perfectly, but my script is in the root directory, bootstraping PW. request = $.post('/public_html/pw/contactus.php', serializedData); My question is, it is possible to put this PHP script in my templates directory and call it from there ? (if I hardcode the path I get a 403 HTTP error and doing that can cause problem between dev environment and production); How I should code my path in the Javascript code ?
  9. Hello everyone, in the first line I need to say, that I am NO developer or programmer. I am just a german language translator and interpreter who is seeking for help. The freelancer who created a website ( I have tried to change the code in this line: <a href="'.$page->siteurl.'">. I managed to get the link work but just for one language. If I changed the language version the link showed me always the same version. Can someone tell me if someone like me without any knowledge in this matter can handle it to get this thing done? fix a problem with 'SEO boxes' visible here http://berlineo.com/pl/oferta/tlumaczenia-pisemne/''>http://berlineo.com/pl/oferta/tlumaczenia-pisemne/'>http://berlineo.com/pl/oferta/tlumaczenia-pisemne/ at the bottom (looks like radio button); the code was copied from the home page, where these SEO buttons are OK; I need this section to be usable wherever I wish to paste it; Can sombody tell me the reason for this and help me fix it? Thank you in advance!
  10. My site has several pages that require access to one-off scripts the rest of the site doesn't use. To keep pages loading as fast as possible we don't load these scripts on every page. Instead, we typically include them on a per-page basis in an extra block loaded after the footer html. When I first started trying to port to PW I added textarea fields for "extra_head" and "extra_footer" into my primary template, and I hoped I could include these script loading directives in the "extra_footer" block and be off to the races. In fact, this would have worked beautifully if I had hard-coded paths for these scripts. There's the rub, however! I was trying to do things the PW way, so I used the php directives to get the path to my site's "templates" folder. When I output this "extra_footer" field in the page, the php doesn't get executed, so I never get the script path, and the whole thing fails. <script src="<?php echo $config->urls->templates?>static/js/jquery.isotope.js"></script> I don't know if I have output the field in my template the wrong way, so maybe there's some other php or api call that will cause it to actually interpret the code in this field during output? Here's what I have used: <?php echo $page->extra_footer; ?> I had this problem in other places, too. For example, during the port of the site we decided to start out with a "body" textarea that we bulk-dropped the html markup from the previous site into. This html had references to images and other static resources that we tried to access with the same type of php path reference as in the example above. Of course, none of it worked because that php code never gets executed. Is there a way to have the php in fields get executed during the page production? If not, is there some other reasonable way to get the path to site resources like scripts and general-purpose images (that wouldn't usually be included in a page's "images" field? Thanks, Rick
  11. I'm attempting to make a photoblog type of site and was wondering if there's a clean way to get the image directory path when using the $image->size method. The purpose of this is so the user can upload their large images, display as a thumbnail and click to view a medium version no taller than 800px within a modal. As you can see, I've had to hardcode the site/assets/files directory. Is there another method? (*the getThumb function refers to another installed module) foreach($page->images as $image) { echo '<a href="site/assets/files/'.$page->id.'/'.$image->size('','800').'"><img src="'.$image->getThumb('thumbnail').'" alt="'.$image->description.'"/>'; }
  • Create New...