Search the Community

Showing results for tags 'template'.



More search options

  • Search By Tags

    Type tags separated by commas.
  • Search By Author

Content Type


Forums

  • 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

Found 145 results

  1. Hi, Yesterday I found out about the relatively new markup regions functionality and I love it. The ease of use and simplicity is just what I think is typically ProcessWire and is why Im still happy I chose for PW four years ago when changing CMS/CMF. So thanks Ryan for your vision and all you put into it. That said, Im running into an issue I'm not sure what to think of it. I have enabled markup regions in config.php and it does what I suppose it should: it replaced and all. Very neatly. The only thing I discovered is that while Im debugging some issues and I use var_dump to echo some stuff, it does that two times in a row. And this only happens when useMarkupRegions is enabled. I dont get this, does it mean the template file gets called twice (and thus the script is run twice?) or is it only displayed twice, where the first time most output is erased and /or replaced by the substituted output? I don't really get whats going on there. Is this behavior normal when using markup regions? Thanks!
  2. I'm working on a page and it's showing up differently when I'm logged in. It's not that a field is set to private or anything, because it's still pulling data from that field. It looks like the "public" view is simply using an old version of the template (home.php), and the logged-in view is using the current version of home.php. See attached screenshots. Is there something that caches template files? Is there a way to force it to use the most recent version of the template? EDIT: I found the Pro Cache module and cleared it. That seemed to help. Thanks, -Mike
  3. I am new to PW, and am trying to get an image to display, from a field in my template. Here's the code I'm using: <?php $image = $page->home_header_image; echo "<img src='{$image->url}' alt='{$image->description}' />"; ?> I'm following the tutorial on this here. When I save the template and reload the page, the path to the image is incomplete. If just echoes: <img src="/site/assets/files/1/" alt=""> It omits the name of the image, at the end of the path. Here's the site I'm working on: http://dev.delucaswpg.webfactional.com A couple caveats: I'm using ProcessWire 2.3.0 (tried updating the site and everything went berserk because of some plugin dependencies; point being: I can't update to the latest PW). I tried using the ->size thing and it gave me an error, saying it couldn't use 'size' in this context. Which I also thought was weird. Any ideas? Thanks!
  4. I originally created my template files thinking I'd only ever need 3 and not worrying about if I repeated bunches of common code there (yes, bad practice, I know). I figured I'd just manually/copy-paste to change any common code in all 3 as needed. So of course, fast-forward awhile, and I'm now up to 6 template files with possibly a few more to come, and decided it was high time I made the switch to keep the common parts in their own unique files for ease of editing. So I therefore went back and read Ryan Cramer's tutorial "How to Structure Your Template Files". OK. I tried out the "includes" command mentioned in the tutorial on a test template. The resultant web page physically functions as expected, but my question here is, "Is the practice I'm showing below OK in terms of variable usage?" If not, what approach should I be using? I've tested it out and the variables do populate as expected in the final result, but is it OK for me to do it like this or is there the chance that some of the variables won't be passed properly? Here is what I mean (only the relevant portions of code shown to illustrate): ... <aside> <h3>Three Random Posts</h3> <!-- get the list, then display it --> <?php $itempages = $pages->find("template=my-post"); $shortlist = $itempages->getRandom(3); $shortlist->shuffle(); $itempagezero = $shortlist->eq(0); $itempage1 = $shortlist->eq(1); $itempage2 = $shortlist->eq(2); ?> <?php include("./INC_displaylist.php"); ?> </aside> <?php include("./INC_footer.php"); ?> </body> </html> The possible issue here is that the INC_displaylist.php file outputs field data from $itempagezero, $itempage1, and $itempage2. Is that OK? I wanted to split the variable assignments and the output separately. This is because, based on the exact template I'm using, I will sometimes choose to populate $itempages via different selectors in the $pages->find command in different template files, although all templates will display an identically-formatted list of 3. By contrast, I wouldn't expect any variable issues with including the INC_footer.php file as shown above, since I'm not using any variables in the footer that aren't first referenced in that same footer. So am I doing it OK here or should I be populating these variables somewhere else to ensure they're recognized properly by INC_displaylist.php? If I need to do it somewhere else, where should I populate these?
  5. Is the template name a value which I can display? I've read the API docs re. template names and tried a few things including below but nothing works so far. Template is: {$page->$template->name} FYI I'm building a small 'helper' section in a footer which is only visible to admins and it will display page ID, template name and a link to edit the page. Everything working apart from displaying the template name.
  6. Hi all, Im currently building a photo sharing website and have a first version finished. Next step is to incorporate notifications in the website if a user likes one of your photo's, or comments on a photo you posted. Just like the notification bell at the top of the forums. Any idea how to approach this functionality? Thanks in advance.
  7. Hello, I am testing Processwire. Usually, we can found many templates but, here, I an't found. Only existing sites. Nobody share template for free or not ? Thank you
  8. Hi, How can I display, on every page of my site, what roles can view that pages template, based on what is checked in settings>templates>template-name>ACCESS TAB? I've only gotten as far as displaying the name of the current template: echo $page->template->get('name'); But I'm stuck here. Tried things like $page->template->get('permissions'); but I guess it's a bit more complicated than that. Hope someone van point me in the right direction. Cheers.
  9. So maybe has already figured this out, but I am stumped. I have a field (test_field) that is set to pdfs, and I was trying to get a count of the number of pdfs in that field so I could add it to a status bubble on the front end. I tried: function testPDF() { $a = $page->test_field->count(); echo "<span class=\"bubble\">" . $a . "</span>"; } but it is returning "NULL" . I currently have 3 added to the field. I also tried putting this function in _func.php, though I need to use wire('pages'), but I only need to get the count for that specific page, so I am sort of at a loss of how to proceed.
  10. Simple example for loading template specific CSS file. This example asumes that you have your CSS file in a directory relative to template root. Like: templates/css/my_template_specific.css Also i use in the template a simple text field to hold the name of the CSS file i want to load. I call this field 'css_file' Use what you feel comfortable with. So in your header section of the DOM notice the "page specific CSS" part? Thats were the magic happens. What happens is that we check to see if the file exists in the CSS dir relative to template root. And if it does we load it. Simple and effective. I load all other CSS that is used all over the site in global_styles.css first. And make sure you load template specific last, because then you can easily override CSS in global. DOM header example: <!DOCTYPE html> <html> <head> <meta charset="utf-8" /> <title><?PHP echo($page->title); ?></title> <!-- main CSS --> <link rel="stylesheet" href="<?PHP echo($config->urls->templates); ?>css/global_styles.css"> <!-- page specific CSS --> <?PHP /* Use relative path in file_exists() */ if(file_exists('css/' . $page->css_file)) { echo("<link rel=\"stylesheet\" href=\"{$config->urls->templates}css/{$page->css_file}\">"); } ?> </head> <body> Thats my way of doing it. I am sure there is plenty of more ways to do it. This is for the newbies or anyone that wants more options. Good luck with your CSS out there in Cyberspace. Cheers from EyeDentify
  11. I've a page "blog" which have child pages (blog posts). Right now I've 11 pages (blog posts) and I'm fetching all the posts in my "blog" pages which displaying fine, Issue is only 10 results are showing this is how I'm fetching $entries = $pages->find("template=blog-entry"); foreach($entries as $entry){ <a href='{$entry->url}'>$entry->title</a> }
  12. Hello all. I know it might sound silly, but wanted to check how are you guys proceeding if in the theme development you have a need of some fields that are repeating in several templates. For example, I am having an image field that can be used as the site logo in "Settings" template or as to show the page image in the markup of the inner page template or else. I am aware, that if I leave the resizing in the markup, than the field can be used on multiple templates, but the field has some specific label/description, notes and/or placeholder that would be not-related. Sticking to the logo example, I have a label saying: Add your logo image here. So if I use the same field for something else, the same text would show while editing the new next page calling for image. How are you guys taking care of this? Are you creating specific fields for every aspect of your theme or there are some tricks I am missing in the big picture? P.S. Besides the descriptive text of the field some might require to have a single image and some an array (e.g. you don't need to upload multiple logos, unless you want to randomize or call one based on some criterias, but for a gallery - sure I would have multiple)
  13. I'm new to PW... I'd like to have some blog posts displayed on our homepage based off the attached mockup. I want each post to use a slightly different layout. Is this possible?
  14. Noob to Processwire. Trying to convert some older sites to Pwire. I am having trouble including a legacy form class into my templates: If I embed the php directly in the template, it works. But if I use include statements, the form object returns null. This works: use formbuild\Form; session_start(); $form = new Form(init1, 'init2', ...'); $form->param1 = ...; $form->param2 = ...; $form->param3 = ...; $form->render(); ----------------------------------------------------------------------------------------- This fails: include_once ($config->paths->templates."forms/form1.php"); $form->render(); ____________________________________________________________________ My referencing is OK, no error message. The only code that cannot reside in the include file are the following lines: use formbuild\Form; $form = new Form(init1, 'init2', ...'); My PhP is rusty, maybe that is the problem, but it could be something about Pwire, namespace maybe. I have tested it outside Pwire and no problems. Please advise. Thanks.
  15. Is there a module or plugin that is like a repeater but you can choose a template? I want something that let's me: choose a template to get fields from, display these fields like a repeater does add new pages without adding a title or name (this might be achievable using other means like ProcessSetupPageName) delete pages I feel like somebody might have already made a module that does just this, however, I haven't found any. Perhaps there is a way of doing this with a standard repeater that I don't know about.
  16. I have an issue where I want different formats for creating one page. When you are creating a new page I want it to offer different types of fields from when you are editing it. For example, I have a field called countries which is a multiple page reference field. This is desirable as it is in a very easy to edit format. Currently, I am using selectize.js which makes it possible to search for the pages and add them in a tag fashion. This is how I want it to be when a page is already created. However, when creating a new page it is often easier to just paste a list of all the countries as text. This is because the data is coming from an old website where the countries are written like this: I can code something which converts this text into the multiple page reference fields but I am not sure how to go about it. At first I tried making another template which had fields that were in this “quick” format. Then I planned to make it such that when you add one of these quick pages it creates a page in the standard format and deletes itself. This has it’s own problems such as where to place the new page, what title and name to give it, whether to have just one quick page or multiple and when to delete it. It just didn’t seem right. Another possibility would be to show special quick fields when creating a new standard page but hide them when the page is saved and show the standard fields. I am not to sure how to achieve this though. Does anyone know a better way of going about this? I feel like this is a simple problem which already has an elegant solution.
  17. Question 1 I recently installed PW 3.0.62 for a new site and also have sites running older version of PW 3.x. Can I export the database on an older version of PW 3.x and import it to PW 3.0.62 without any issues? Question 2 (This is kind of alternative to the above for long term use - and maybe a better solution...) On the sites I've previously built I have templates (home, basic-page, contact) and fields that I commonly use, such as business_name, phone_1. The last site I built is running PW 3.0.42. I was considering cloning this into a local site and running the upgrade module to bring it up to PW 3.0.62. From there on out when I start I new project I could just run the PW upgrade module, copy the folder to the location for the new project and duplicate the database using the new projects name. So basically, I'll always keep a "blank slate" site that I can just run the PW upgrade on, then duplicate into a new project. This would cut down on the work and time spent having to re-create these common fields, that I use. From there, I would just add fields, templates, etc, specific for the new website project. Is this a sound approach to speed up development?
  18. Hi, In one Page I would like to put a lot of url. There is url's field. Now, I add url's field to one template, but I don't know to add 2 or 3 or 10 url's field in that same template... the problem is simple, but processwire don't allow it...
  19. Hello. Sorry in advance for the super basic question, from a total begginer: -when I want to create a new template in the admin, I have to create firstly a ''new.php'' page in the site/template folder. -Is it possible to do the same in an ''_new-include-some-page.php'' in the site/template/include folder? I was thinking to a solution: removing the Include folder, and put all the .php pages in the template folder. But, I am sure I am missing something, and other solutions exist. An advice? Thank you for your time.
  20. I wasn't quite sure where to post this, as this is a question regarding the module (sorry if it is in the wrong place). I was wondering if anyone has used the Email to Page module and figured out a way to "move" incoming css to another field, or how to render the css so the message just renders utilizing the css. Right now all of the message contents get dropped into a textarea field and display in a template as a jumbled mess. Perhaps I am missing a formatting option in the text area field to render the css and html.
  21. I wish to access a template's allowed templates for it's children from the API. This one: I am pretty sure this is possible, but I can't seem to find it anywhere in the documentation. If this is not possible, is there some way of assigning properties to templates? So like fields that already have a value on all pages using that template.
  22. My site works very well until today I fill a bunch of multilanguage fields than suddenly it start to this. I can't reach any page, everything gives 500 error. and log is: 2017-07-12 09:33:56 guest Error: Class 'Twig_Loader_Filesystem' not found (line 338 of /home/petform/public_html/site/modules/TemplateTwigReplace/TemplateTwigReplace.module) How can I fix this?
  23. Hey everbody. I wanted to share something I have been working for quite some time, in total currently three premium Templates or Site-Profiles for ProcessWire 3 including a onepage template, a blog template and a blog+sidebar template. Here are some Quick Facts: Fully responsive Multilanguage support Full SEO support Optional Google Analytics Easily create new pages out of multiple predefined sections Lazyload the sections of a page [Group and update website-information into blogs] (blog, blog+sidebar) [Use tags to tag and group blog entries] (blog, blog+sidebar) [User-comments] (blog, blog+sidebar) [Create each page with or without sidebar] (blog+sidebar) Website-wide search by text or tags Password protect each page individually with sophisticated page-encryption with dummy texts and pixelated images Just go to https://pwtemplates.de to test the demos (e.g. blog-sidebar) and purchase them for a small expense allowance. Hope you like it!
  24. I am using regions with the tag <region id="whatever"> in the _main.php file. Config file is set up as follows: $config->useMarkupRegions = true; $config->prependTemplateFile = '_init.php'; $config->appendTemplateFile = '_main.php'; When I use a page template that changes a region, all goes well. However, I set up the _main.php file to reflect the output for a basic page. The basic-page.php template needed no customisation so was simply as follows: <?php namespace ProcessWire; ?> When a page with the basic-page template was output, all the <region> tags remained in the HTML, ie were not stripped. When I added a customised region to the basic-page.php template, all the <region> tags were stripped from the output _main.php HTML. Did I do something wrong or is this a bug? Using ProcessWire 3.0.63 © 2017
  25. I believe I have hit a roadblock on this one. I am trying to pass an array to a "cc" in wiremail (using wiremailsmpt to extend). Everything else is working, but I am getting an "invalid email address" for $cc_recipient[0]. I looked in wiremail, and it is checking to see if it is a valid email address before sending (which my variable is not). Is there a way around this by chance?