Search the Community
Showing results for tags 'template'.
-
Hi, I red this: http://processwire.com/docs/tutorials/installing-a-css-framework/page2 and Perahps I don't understand anything. Excuse me! But, I gone here: http://www.free-css.com/free-css-templates/page198/istria-1 and I downloaded the package. In this package there is 4 directory: "css", "js", "img", "images" and out it some html files. Then, I gone bye ftp filezille in to my site, and I charge those 4 directory on .../site/templates. But my site is as before. The aspect is the same. How I wrong? Question two. I seen the new forum with personal homepage for all members, that seem as facebook! There'is a modules "forum" for do same wonderfull thing in any site PW, or I must write all code by my hand? Thank you for any replace!
-
Hi. I wonder if is there possibility to limit page children to specific template. I know that it can be done in template settings. But I think it could be good option to do it in page settings. Lets say we have templates like news, gallery, author, tag, movie, song itc. We have also pages with the same names. If we want page 'Video' to accept children only with template 'video' we need to create template like 'videos-container' and set it to accept only children with template 'video'. And so on with other pages and teplates. It ends with many 'empty' templates which role is only limitation child templates in specific pages. If we could limit children templates in page settings it would be enough to have one template like 'common-container'. PS: sorry for my bad english.
-
Maybe i don't see it but how can i delete pages with admin template? PW 3.0.18 logged in as superadmin - advanced mode on... status: System: Non-deleteable and locked ID, name, template, parent (status not removeable via API) is checked...but i wanna remove this page it's from a failed installation of a module...i've deleted module files and db entries...so far. But the admin page stays.. Regards mr-fan
-
I saw in the 'template structure methods' in the doc section that ryan mentioned a mvc method for beginners. When will it be published? https://processwire.com/docs/tutorials/how-to-structure-your-template-files/page5 I'm just curious
-
Using Switch Statement with Select Options Fieldtype
louisstephens posted a topic in API & Templates
I thought I had it figured out, but what I coded doesnt seem to be working at all. First let me set up what I am trying to do. Each page of the site has a different background color, so I was going to use a switch statement to just change the div class in conjunction with the Select Options Fieldtype, The switch: $switchColor = $page->switchColor; switch ($switchColor) { case "brown": echo "<div class='container inner-brown'>"; break; case "blue": echo "<div class='container inner-blue'>"; break; case "red": echo "<div class='container inner-red'>"; break; default: echo "<div class='container inner-green'>"; } I also set up a Select Options field type to be used on those pages, which is set to allow only 1 selection. However, it seems that it is failing somewhere and is defaulting to the "green". Did I not "select" the selection the correct way? -
Hi, I'm wondering if it's possible to add a custom button or link to a backend template. Example: The orders of my online shop are saved as pages with the template "shop". Now it would be nice to have a button (or a link) in this template, which opens a page, which creates the invoice as PDF file. Is there a way to add such a button or link? Thank You, regards SebastianP
-
I've been using the intermediate template structure (_init.php, _main.php and string concatenation to build output for my various template sections defined in _main.php This is a bit of a ball-ache as it renders my templates hard to use in editors (string concatenation doesn't work well with element matching/bracket matching. Is there a better way to put this together (not using includes)? e.g. _main.php <?php if($band1_content):?> <section class="w-section page-heading grey"> <div class="w-container inset-container"> <?php echo $band1_content;?> </div> </section> <?php endif; ?> band.php $band1_content = '<div class="w-container inset-container tabs filter-options"> <a class="w-inline-block pr-tabs" data-group=""><div class="pr-tabs-text">All</div></a> <a class="w-inline-block pr-tabs" data-group="'. $pages->get(1015)->name.'"><div class="pr-tabs-text blue">'. $pages->get(1015)->title.'</div></a> <a class="w-inline-block pr-tabs" data-group="'. $pages->get(1016)->name.'"><div class="pr-tabs-text green">'. $pages->get(1016)->title.'</div></a> <a class="w-inline-block pr-tabs" data-group="'. $pages->get(1017)->name.'"><div class="pr-tabs-text orange">'. $pages->get(1017)->title.'</div></a> </div>'; Pete
- 13 replies
-
- template
- intermediate
-
(and 1 more)
Tagged with:
-
Hi, I'm trying to figure out if it's possible to add a "field" of some sort to the templates. See, this "field" isn't exactly a like the regular fieldtypes that would have different values depending on the pages that use that template. What I'm looking for is almost exactly the same as the Tags field in the advanced tab of the template settings. My use case scenario is that I want to put some keywords in there that would be available to all the pages using a particular template, and then I could perhaps use those values to determine dependencies, etc. I could actually achieve this with the existing tag field, but then it messes with the templates list because they appear multiple times depending on how many tags I put in them. So my question is how or if it's possible to add another field like it to templates? Thanks.
-
Hello All, I have an issue editing certain pages with specific templates. I noticed this issue after migrating from MAMP to a production server. Not sure if there's a relation there but just had to mention it. 'Error: Call to undefined method DirectoryIterator::getExtension() (line 104 of /var/www/vhosts/.../httpdocs/wire/core/Pageimages.php) This error message was shown because you are logged in as a Superuser. Error has been logged.' When line 104 in Pageimages.php is commented out i'm able to edit the pages successfully. Any help or information will be appreciated. PW Version 2.5.25 DEV
-
Hey all. I have a question concerning templates and a possible setting to disallow/prohibit to view pages that are using certain templates. I have a couple of templates that are not complete page-templates including header/footer but are sections-templates. E.g. I have a template called 'Case' and every page using this template can add section children, e.g. first a section-video, then section-textblock, ... Doing this, the user can create its own cases out of building blocks. However, up to now one can select 'view' in the page-tree in the admin panel to view each sections. This view failes, as they don't have a header/footer. Can anyone of you think of solution how to disable that one can view pages with template section-* ? Thanks a lot in advance!
-
Hi there, I am using the following template file to provide a pdf download, of a pdf stored in a file-field. <?php $file = $page->pdf->filename; header('Content-Type: application/pdf'); header('Content-Disposition: attachment; filename="'.basename($file).'"'); header('Content-Length: ' . filesize($file)); readfile($file); If template caching is disabled, everything working as expected and the following header is sent HTTP/1.1 200 OK Date: Fri, 26 Feb 2016 13:03:27 GMT Server: Apache X-Frame-Options: SAMEORIGIN Expires: Thu, 19 Nov 1981 08:52:00 GMT Cache-Control: no-store, no-cache, must-revalidate, post-check=0, pre-check=0 Pragma: no-cache Content-Disposition: attachment; filename="anyfile.pdf" Content-Length: 909233 X-XSS-Protection: 1; mode=block Keep-Alive: timeout=2, max=1000 Connection: Keep-Alive Content-Type: application/pdf Using Template cache the header is overwritten by HTTP/1.1 200 OK Date: Fri, 26 Feb 2016 13:06:11 GMT Server: Apache X-Frame-Options: SAMEORIGIN Expires: Thu, 19 Nov 1981 08:52:00 GMT Cache-Control: no-store, no-cache, must-revalidate, post-check=0, pre-check=0 Pragma: no-cache X-XSS-Protection: 1; mode=block Vary: Accept-Encoding Content-Encoding: gzip Keep-Alive: timeout=2, max=1000 Connection: Keep-Alive Transfer-Encoding: chunked Content-Type: text/html; charset=utf-8 Any ideas to prevent this?
-
Hey All. I am currently writing a very small module to accomplish the following: - I have a Page "Service Types" with multiple childs "Service Type". Whenever a new "Service Type" is added, a Field (in my case FieldtypeRangeSlider) should be generated, eg "servicetype_communication_rangeslider" and added to an existing template ('case') at a specific position. I have little experience with modules but managed to get it done till the successfull creation of the range-field. But now I am struggeling with adding it to the template. First, I havend managed to get a list of templates in the module..just a workaround via pages and selector template=case. I think this would work, but only of there are pages with this tempalte. If not, this solution fails and in general, I don't know how to get the templates in a module. Second, I have no clue how to add a field at a specific position to an existing template (to an existing Fieldset in my case). Here is my code so far: class AddServiceTypesByPage extends WireData implements Module { public static function getModuleInfo() { return array( 'title' => 'Add ServiceTypes By Page (Didhavn)', 'version' => 1.0, 'summary' => 'Add the ServiceTypes by getting Pages with Template "service-type"', 'singular' => true, 'autoload' => true ); } public function init() { $this->pages->addHookAfter('added', $this, "hookAdded"); } public function ready() { // PW API is ready, Controllers go here } public function hookAdded(HookEvent $event) { $page = $event->object; if (!$page->template) { $page = $event->arguments[0]; } if($page->template == 'service-type') { $f = new Field(); $f->type = $this->modules->get("FieldtypeRangeSlider"); $f->name = 'servicetype_' . $page->name; $f->label = 'Service-Type ' . $page->get('title')->getDefaultValue(); $f->set('suffix','%'); $f->set('tags','servicetype'); $f->set('icon','fa-sliders'); $f->save(); /* * now add the field to existing template with name 'case' */ } } } I am thankfull for any help or suggestion! Thanks a lot!
-
Hello again everyone, I'm creating a template with an easy-to-use front-end adminbar (basically says: "Edit Page", "New Page", "Add News", "Add Product") and to make it more "user-friendly" it has the editor avatar and name as well as the options for "Profile, Help and Logout". I wanted to use PW's Comments Fieldtype and found that it's possible to display comment count here: http://processwire.c...rns-odd-number/ and I also found that it's possible to check comments since the last visit here: http://processwire.c...nce-last-visit/ I am now wondering *if* it's possible to display the total comment *count* from all pages containing the 'comments' field. Basically like this: "Welcome Back admin, there are {$comment-count} new comments." and that would redirect to the Comments Manager module. I've looked around the forum but didn't find anything similar, and I'm not really good with PHP so I might've overlooked a function. Thanks in advance. EDIT: Can I use something like: $count = count($comment) ?
-
Maybe I have messed up somewhere here (As it is working on my local server), but an image used as the header on the live branch has just suddenly "disappeared". I imported all of my fields from my local branch (which included the pageHeader image field), and loaded in my content just fine. Yesterday I was just going through a few of the demo pages and the header image is no longer displaying on site. I looked at the page itself on the backend and the image is displaying there, just not in the front end. Is it possible for the data to corrupt over a few weeks? If you look at the screenshot, it looks like the code isnt even pulling in the image to the src.
- 1 reply
-
- image field
- images
-
(and 1 more)
Tagged with:
-
hi! i'm trying to get the label of my field that i use in two templates with different name. so i'm trying to get the label through the template. so my code is echo $templates->get("home")->fieldgroup->get("text")->label; but it gives me the general field label not that i'm using for the home template any idea?
-
On my dev (localhost) my gallery appears to be working just fine. It is set to "Automatic", and if I drop in 8 images all of them upload in the order I selected and all save out. However on my production server, the images upload all out of order and then it deletes 4 of them. Has anyone else had this issue or know how to solve it?
-
Ok, so I have been scratching my head on this one for the last hour. I had three repeaters that I needed to delete from the list to create some new ones (I removed them from the template via actions). However when I go to delete the repeater, it is saying it is still use by 3 other pages. I am at a loss of what to do.
-
Hello, I have a site with users that have a custom user template setup on PW 2.7.2 stable. Custom user template is "member" and role for those users also "member". The site has a frontend dashboard where users can edit their profile, events etc. I can login with this user type to the backend fine and the permission settings are all working. When I login to the frontend, I get this error: "Fatal error: Maximum function nesting level of '10000' reached, aborting! in .../wire/core/Wire.php on line 333"; I already raised the xdebug.max_nesting_level from 1000 to 10000. When I set it to 100000, the server disconnects. I can see that the user gets logged in with $session->login($uname, $pass) before the error is thrown. EDIT: When I reload the login page after the error shows with the now logged in user, I get this error: "Fatal error: Maximum function nesting level of '10000' reached, aborting! in /var/www/utgpw/wire/core/Fieldgroup.php on line 61" But a $session->redirect($dashboard->url) seems to cause the error. If I logon with a test user that has role "member" but the regular user template, I don't get the error and get redirected to the dashboard fine. All the code in my dashboard template is working. Actually, the whole login and dashboard logic for the frontend is copied from another site where it has been working fine for over a year now. So I guess the problem is related to how the custom user templates are handled in the core. My setup for the custom user template has also proven to work without issues in 2 other sites. I have spent hours on debugging already and now I'm lost. Any ideas that point to the cause of this would be much appreciated.
-
I was struggling a bit getting all subfields of a field if type is unknown. I made a small function for use in templates which returns an array() of all properties of (maybe any?) pagefieldvalue. If there is something similar in core (which I couldn't find) please let me know. Tested it with Fiedtype Options, Page, ProfieldsTable. Feel free to use it. /** * ProcessWire UsefulSnippets * * How to get all properties, subfields of any field if you don't know the type only if value is set * @return array */ function getProperties($fieldvalue) { // multiple value field if ($fieldvalue instanceof WireArray) { $result = array(); foreach ($fieldvalue as $subfieldvalue) { $result[] = getProperties($subfieldvalue); } return $result; // single value field with subfields } else if ($fieldvalue instanceof WireData) return get_object_vars($fieldvalue->getIterator()); // single value field else return $fieldvalue; } // Example var_dump(getProperties($page->myfield));
-
Setup: PW version 2.7.1 dev template cache is disabled Chrome Canary is opened with disabled cache and in inkognito view mode When I make a change to a template file (say the basic home.php) I want to immediately see that change after refreshing the browser. Example: This is the content of home.php: <?php echo "bla"; I browse to the root page and see the "bla" output. I change the code to <?php echo "bla1"; and save the file. After that I immediately reload the page in the browser and I don’t see the change to "bla1". Only after multiple browser reloads (at times also more than 20 reloads) and "hard" reloads does the change appear. What I tried to do: set $config->dbCache, $config->sessionFingerprint and $config->sessionChallenge to false in config.php delete all sessions re-save the page in the ProcessWire backend and reload the browser page completely delete the browser history (cookies, cache, everything) after the first visit to the page Nothing helped. Questions: Can someone replicate this behavior? What can I do to achieve the desired behavior? Thanks a lot in advance for any help.
-
Hi everyone, I know the answer is right in front of me, but I've searched it for days already. I guess I'm still a beginner... please help me! I'm using the multi-language site profile, suggested in the installation of processwire, if that helps. I want to apply the fancybox only to the images of one template. Fancybox is already running, I put the necessary code in the _main.php file. <link rel="stylesheet" href="<?php echo $config->urls->templates?>scripts/fancybox/source/jquery.fancybox.css" type="text/css" media="screen" /> <script type="text/javascript" src="http://code.jquery.com/jquery-latest.min.js"></script> <script type="text/javascript" src="<?php echo $config->urls->templates?>scripts/fancybox/source/jquery.fancybox.pack.js"></script> <script type="text/javascript"> $(document).ready(function() { $(".gallery").fancybox({ }); });</script> Therefore I created a new template php called "gallery.php" and put that code inside. foreach($page->images as $image) { $thumbnail = $image->size(150,100); echo "<a class='gallery' rel='gallery-1' href='{$image->url}' title ='{$thumbnail->description}'><img src='{$thumbnail->url}' style=' padding: 5px;' ></a>"; } Now it shows the kind of gallery I want to have, but at the wrong possition of the site. I just don't know what I have to write in there to change the position. perhaps it is something like $content =... , but I already tried every combination I could think of and I've looked at all the tutorials I could find. I'm thankfull for any help, Leo
-
Hi I have a question about the "Name format for children" option for Templates. This option only shows up when i allow 1 single template under the "allowed templates" option. The Scenario: I have a template called "activity", the activity template can have or it is allowed only to have 4 template types as children: date, cast, image and video. My Problem is that i want that only the page name of the date pages are genereated automatically with the "Name format for children". But this option is only working when i allow only 1 template as children. How can I achieve, that the "Name format for children" works also when its allowed more than 1 children. Here is the Tree structure for visualization:
-
Hey guys, I'm trying to build a submit form with the ProcessWire API. After the form is submitted its data should be saved into different pages. I've followed Soma's great tutorial and wanted to improve it for my use case: Instead of adding every field manually to the form I already managed to automatically read out the fields that belong to a specific template like this: // Build form $form = $modules->get("InputfieldForm"); $form->action = "./"; $form->method = "post"; $form->attr("id+name",'$page->name'); // Build fieldset $fieldset = $modules->get('InputfieldFieldset'); $fieldset->label = 'Personal Data'; // Read out template fields and append them to the fieldset $registration = $templates->get("registration"); foreach ( $registration->fields as $field ) { $field = $field->getInputfield($page); $fieldset->append($field); } $form->append($fieldset); // more fieldsets... // Submit $submit = $modules->get("InputfieldSubmit"); $submit->attr("value","Anmelden"); $submit->attr("id+name","submit"); $form->append($submit); This seems to work great – with just one little restriction: Instead of the global field labels I would love to get the template specific settings for each field (defined within the template). E.g. in this template I'm using a body-Field not labeled as "Body" but as "Description". Same would be great for things like field's columnWidth, required properties and Co. Is this possible? Thanks a lot for your help! Nik
-
Hi there, today I was playing around with Bootstrap 3.1 and PW. I downloaded a boilerplate template for Bootstrap3.1 from initializr. Then I took a virgin PW 2.4 install and merged the initializr files with the files in PW template folder. I didn't touch any of the content and tried to replicate the site-default template as close as possible with Bootstrap markup. Only thing I added is a carousel instead of the random image. The result is a default PW install with Bootstrap look. For the main menu, I took Damienov's rendering function from here. To install my template: 1. Do a default PW 2.4 install 2. Unzip the attached file 3. Replace the original site/templates folder with the one from the attached zip file. The result can be seen here: http://pwboot.webseiten-fuer-alle.de/ templates.zip
- 3 replies
-
- 8
-
-
- template
- bootstrap 3.1
-
(and 1 more)
Tagged with:
-
Lets say i have a template with the following fields: title address_street address_additional_road address_zip_code address_place address_country address_email address_tel_1 address_tel_2 I want to output a table with the label of the field and the value of it. $out .= "<h3>{$page->parent->title} Details</h3> <div class='span8'> <table class='detail-view table table-striped table-condensed'>"; $out .= "<tr class='odd'><th>ID</th><td>{$page->id}</td></tr>"; //get all the fields: $all_fields = $page->fields; foreach($all_fields as $field){ $out .= "<tr class='odd'><th>{$field->label}</th><td>{$page->get($field)}</td></tr>"; } $out .= "<tr class='even'><th>erstellt von</th><td>{$page->createdUser->name}</td></tr> <tr class='odd'><th>erstellt</th><td>".date("Y-m-d H:i:s", $page->created)."</td></tr> <tr class='even'><th>aktualisiert</th><td>".date("Y-m-d H:i:s", $page->modified)."</td></tr>"; $out .= " </table> </div>"; In the foreach, it only outputs the title and I also get warnings: Warning: Illegal offset type in /Users/praktikant/Sites/Kulturdatenbank.pw.2.0/wire/core/WireData.php on line 41 Warning: Illegal offset type in isset or empty in /Users/praktikant/Sites/Kulturdatenbank.pw.2.0/wire/core/WireData.php on line 39