Jump to content

Search the Community

Showing results for tags 'php'.

  • 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

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

    End


Last Updated

  • Start

    End


Filter by number of...

Joined

  • Start

    End


Group


AIM


MSN


Website URL


ICQ


Yahoo


Jabber


Skype


Location


Interests

  1. Hi there, I'm having a weird issue with the instanceof operator where it works locally and not on my server. I'm using PW3 + PHP7. I've posted the question on Stackoverflow but I was wondering if anyone here have seen it? http://stackoverflow.com/questions/42552855/php-instanceof-works-locally-but-not-on-host-server Thanks in advance.
  2. i decided to extend _uikit.php functionality with extra functions in separate file in case in future updates, in _init.php i included my _uikit_override.php call in _uikit_override.php i have include_once('./_uikit.php'); function ukEventPost(Page $page, $options = array()) { .... its still copy of ukBlogPosts ... but after that i have strange error TypeError Argument 1 passed to ProcessWire\ukEventPost() must be an instance of ProcessWire\Page, instance of ProcessWire\PageArray given, called in C:\WTServer\WWW\pw32\site\templates\home.php on line 34 search► Source file File: ...\WWW\pw32\site\templates\_uikit_override.php:84 74: * - `divider` (bool): Specify true to show a divider between root level items (default=auto). 75: * - `attr` (string): A string of additional tag attributes to add to the `<ul>` (default=''). 76: * - `fields` (array): Any additional fields you want to display for each item. 77: * @return string 78: * 79: */ 80: 81: #include(_uikit.php); 82: include_once('./_uikit.php'); 83: 84: function ukEventPost(Page $page, $options = array()) { 85: 86: $defaults = array( 87: 'summarize' => null, // Display blog post summary rather than full post? (null=auto-detect) 88: 'metaIcon' => 'info', any ideas how to properly include php files and call functions??
  3. I just started trying to clean up an old site, and possible utilize some things I have learned over the past year (especially since my knowledge of php has gotten much better). I was trying to utilize a function to switch out the included header based on the url, but I can't seem to get it right. I started off with: // Include New Header function headerSwap(){ $homepage = $config->httpHost; $header_one = "/page-link-one/"; $header_two = "/page-link-two/"; switch($homepage){ case "/page-link-one/"; include('headerone.inc'); break; case "/page-link-two/"; include('headertwo.inc'); break; default: include('default.inc'); } } However, it seems that it is always using the default case. I tried echoing $homepage, but that doesnt seem to be returning anything. Any help on this would be amazing.
  4. Hi there, I was wondering if anyone has any tips for Multithreading in PHP 7. I've done some preliminary research and not sure which of the following I should be using? 1) Use built in Thread Object in the PHP Language 2) cURL ? https://www.reddit.com/r/PHP/comments/3a2yyu/async_in_php/ 3) This exec hack https://medium.com/async-php/multi-process-php-94a4e5a4be05#.uiboo7tro 4) Some 3rd party Library I'm not aware of? Icicle? I'm implementing a new search that searches the title, contents of the article and the author names. It would normally be 3 sequential searches followed by formatting the results before outputting. Would like to implement some asynchronous searches here and keep it if it runs faster than the sequential counterpart. Thanks in advance!
  5. Hello, I am just started playing around with processwire and it looks very nice. I am not a real developer (hopefully start this education next year). I am working on a template where I took some javascript from aother template. For the front page I have created a repeating field blok wich holds a text blok, a background color and a waves color and waves checkbox (0/1). This all is working. But when the waves checkbox is unchecked I want to add to the div display:none. This part is not working as it is part of the for each for the block (I think). I am a bit stuck, can anyboy give me a hint? testpage is pw.webhoes.nl This is the for each loop <?php foreach($page->extra_body as $extra_bodies) { ?> <div class="container-fullwidth" style="background-color:<?php echo "{$extra_bodies->extra_bg_color}"; ?>"> <div class="container"> <section> <div class="row"> <div class="col-md-12 body-front wow fadeInUp animated"> <?php echo "<p>{$extra_bodies->extra_body_text}</p>"; ?> <?php echo "<p>{$extra_bodies->extra_waves}</p>"; ?> </div> </div> </section> </div> <script type="text/javascript">var waves = <?php echo "{$extra_bodies->extra_waves}";?>; if (waves = 0) document.getElementById('svg_waves').style.display = "none"</script> <div class="svg_waves"> <svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 1440 157"> <g id="footer_wave" fill="none"> <g id="Artboard" fill="<?php echo "{$extra_bodies->extra_wave_color}" ; ?>"> <g id="waves" transform="matrix(-1 0 0 1 1649 31)"> <path id="wave--bg" d="M62.871 104.03C216.871 87.324 286 79.324 589 79.324S958 125 1249 125s445.587 1 445.587 1L1678 225 183.67 235.324S-91.129 120.734 62.871 104.03z"/> <path id="wave--bottom" d="M72.868 151.295C103.996 138.363 484.122 47.5 650.155 47.5c166.034 0 320.54 45.056 611.54 45.056 291 0 464.044-67.495 464.044-67.495l-80 132.939-1437 32s-167-98.777-135.871-111.71v73.005z" opacity=".06" transform="matrix(-1 0 0 1 1794.739 0)"/> <path id="wave--middle" d="M43 2c154-9.807 423.81 29.65 538.81 45.5C696.81 63.35 966 94 1257 94c291 0 457.203-42.22 457.203-42.22l-69.753 97.447H201.001S-111 11.807 43 2z" opacity=".15"/> <path id="wave--top" d="M616.074 103.938c-293.347 0-472.782-20.373-472.782-20.373l70.315 97.447h1455.087s329.601-143.286 174.36-153.093c-155.242-9.807-605.136 26.69-721.063 42.54-115.927 15.85-212.571 33.479-505.917 33.479z" opacity=".1"/> </g> </g> </g> </svg> </div> </div> <?php } ?> Below is my code for the home.php template that includes the above code. <?php namespace ProcessWire; ?> <?php /* include_once("./_header.inc"); */ // home.php (homepage) template file. // See README.txt for more information ?> <div class="container"> <header> <!-- Top Navbar --> <nav id="headeroom" class="navbar navbar-fixed-top navbar-intro navbar-intro-full headeroom-padd" role="navigation"> <div class="container"> <!-- Brand and toggle get grouped for better mobile display --> <div class="navbar-header"> <button type="button" class="navbar-toggle" data-toggle="collapse" data-target="#main-navbar-collapse-fixed-top"> <span class="sr-only">Toggle navigation</span> <span class="icon-bar"></span> <span class="icon-bar"></span> <span class="icon-bar"></span> </button> <a class="navbar-brand navbar-brand-img-lg" href="/"><img src="<?php echo $config->urls->templates?>/images/Logo_webhoes.png" alt="Webhoes" class="img-responsive"></a> </div> <!-- Collect the nav links, forms, and other content for toggling --> <div class="collapse navbar-collapse" id="main-navbar-collapse-fixed-top"> <?php /* <div id="search-wrap" class="navbar-form navbar-right"> <form class='search' action='<?php echo $pages->get('template=search')->url; ?>' method='get'> <input type='text' name='q' placeholder='Search' value='<?php echo $sanitizer->entities($input->whitelist('q')); ?>' /> <button type='submit' name='submit'>Zoeken</button> </form> </div> */ ?> <ul class="nav navbar-nav navbar-right"> <?php foreach($homepage->and($homepage->children) as $item) { if($item->id == $page->rootParent->id) { echo "<li class='current'>"; } else { echo "<li>"; } echo "<a href='$item->url'>$item->title</a></li>"; } // output an "Edit" link if this page happens to be editable by the current user if($page->editable()) echo "<li class='edit'><a href='$page->editUrl'>Edit</a></li>"; ?></ul> </div><!-- /.navbar-collapse --> </div> </nav> </header> </div> <?php /* ?> <div class="container-fullwidth animated fadeIn"> <section id="zoom-out-header"> <div id="zoom-out-background" style="background: url('[[*blog_main_image]]') no-repeat center center; background-size: cover; "></div> <div id="zoom-out-tagline"> <div class="container"> <div class="row no-border no-marg-tb"> <div class="col-md-12"> <h1 class="no-marg-b backg-black-transp20 color-light text-center padd-20">$page->title; </h1> </div> </div> </div> </div> </section> </div> */ ?> <?php // if there are images, lets choose one to output in the sidebar if(count($page->images)) { // if the page has images on it, grab one of them randomly... $image = $page->images->getRandom(); // resize it to 400 pixels wide //$image = $image->width(1140); uit om responsive te maken // output the image at the top of the sidebar... $header = $image->url; // ...and append sidebar text under the image // $sidebar .= $page->sidebar; } else { // no images... // append sidebar text if the page has it // $sidebar = $page->sidebar; echo "$config->urls->templates"; ?>images/full-bg.jpg" <?php } ?> <!-- Full Page Image Background Carousel Header --> <div id="carouselFade" class="container-fullwidth container-marg-b color-primary-backg carousel carousel-fade slide bs-full-slider bs-full-slider-h50 animated fadeInDown"> <!-- Indicators --> <ol class="carousel-indicators z-index-2"> <!--<li data-target="#carouselFade" data-slide-to="[[+idx:decr]]" [[+idx:is=`1`:then=`class="active"`]]></li> --> </ol> <!-- Wrapper for Slides --> <div class="carousel-inner"> <div class="item active"> <div class="fill header-fill" style="background-image:url(<?php echo $header; ?>)"> </div> <div class="carousel-caption height-100 caption-vertical z-index-1" > <div class="caption-vertical-item"> <h1><?php echo "$page->title"; ?> </h1> <p class="lead marg-b20"><?php echo "$page->headline"; ?></p> </div> </div> </div> </div> <!-- Controls --> <a class="left carousel-control z-index-2" href="#carouselFade" data-slide="prev"> <span class="glyphicon glyphicon-chevron-left"></span> </a> <a class="right carousel-control z-index-2" href="#carouselFade" data-slide="next"> <span class="glyphicon glyphicon-chevron-right"></span> </a> </div> </div> <div class="container"> <section> <div class="row"> <div class="col-md-12"> <!-- breadcrumbs --> <div class='breadcrumbs'><?php // breadcrumbs are the current page's parents foreach($page->parents() as $item) { echo "<span><a href='$item->url'>$item->title</a></span> "; } // optionally output the current page as the last item echo "<span>$page->title</span> "; ?></div> </div> </div> </section> </div> <div class="container-fullwidth" style="background-color:<?php echo $page->bodyBackgroundColor; ?>"> <div class="container"> <section> <div class="row"> <div class="col-md-12 body-front"> <?php $page->headline; ?> <div class="wow fadeInUp animated"> <?php echo $content; ?> </div> <?php // Primary content is the page body copy and navigation to children. // See the _func.php file for the renderNav() function example $content = $page->body . renderNav($page->children); ?> </div> </div> </section> </div> <div class="svg_waves"><svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 1440 157"><g id="footer_wave" fill="none"><g id="Artboard" fill="<?php echo $page->bodyWavesColor; ?>"><g id="waves" transform="matrix(-1 0 0 1 1649 31)"><path id="wave--bg" d="M62.871 104.03C216.871 87.324 286 79.324 589 79.324S958 125 1249 125s445.587 1 445.587 1L1678 225 183.67 235.324S-91.129 120.734 62.871 104.03z"/><path id="wave--bottom" d="M72.868 151.295C103.996 138.363 484.122 47.5 650.155 47.5c166.034 0 320.54 45.056 611.54 45.056 291 0 464.044-67.495 464.044-67.495l-80 132.939-1437 32s-167-98.777-135.871-111.71v73.005z" opacity=".06" transform="matrix(-1 0 0 1 1794.739 0)"/><path id="wave--middle" d="M43 2c154-9.807 423.81 29.65 538.81 45.5C696.81 63.35 966 94 1257 94c291 0 457.203-42.22 457.203-42.22l-69.753 97.447H201.001S-111 11.807 43 2z" opacity=".15"/><path id="wave--top" d="M616.074 103.938c-293.347 0-472.782-20.373-472.782-20.373l70.315 97.447h1455.087s329.601-143.286 174.36-153.093c-155.242-9.807-605.136 26.69-721.063 42.54-115.927 15.85-212.571 33.479-505.917 33.479z" opacity=".1"/></g></g></g></svg></div> </div> <div class="container-fullwidth" style="background-color:#<?php echo $page->body2BackgroundColor; ?>"> <div class="container"> <section> <div class="row"> <div class="col-md-12 body-front wow fadeInUp animated"> <?php echo "$page->body2"; ?> </div> </div> </section> </div> <div class="svg_waves"><svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 1440 157"><g id="footer_wave" fill="none"><g id="Artboard" fill="#<?php echo $page->body2WavesColor; ?>"><g id="waves" transform="matrix(-1 0 0 1 1649 31)"><path id="wave--bg" d="M62.871 104.03C216.871 87.324 286 79.324 589 79.324S958 125 1249 125s445.587 1 445.587 1L1678 225 183.67 235.324S-91.129 120.734 62.871 104.03z"/><path id="wave--bottom" d="M72.868 151.295C103.996 138.363 484.122 47.5 650.155 47.5c166.034 0 320.54 45.056 611.54 45.056 291 0 464.044-67.495 464.044-67.495l-80 132.939-1437 32s-167-98.777-135.871-111.71v73.005z" opacity=".06" transform="matrix(-1 0 0 1 1794.739 0)"/><path id="wave--middle" d="M43 2c154-9.807 423.81 29.65 538.81 45.5C696.81 63.35 966 94 1257 94c291 0 457.203-42.22 457.203-42.22l-69.753 97.447H201.001S-111 11.807 43 2z" opacity=".15"/><path id="wave--top" d="M616.074 103.938c-293.347 0-472.782-20.373-472.782-20.373l70.315 97.447h1455.087s329.601-143.286 174.36-153.093c-155.242-9.807-605.136 26.69-721.063 42.54-115.927 15.85-212.571 33.479-505.917 33.479z" opacity=".1"/></g></g></g></svg></div> </div> <?php foreach($page->extra_body as $extra_bodies) { ?> <div class="container-fullwidth" style="background-color:<?php echo "{$extra_bodies->extra_bg_color}"; ?>"> <div class="container"> <section> <div class="row"> <div class="col-md-12 body-front wow fadeInUp animated"> <?php echo "<p>{$extra_bodies->extra_body_text}</p>"; ?> <?php echo "<p>{$extra_bodies->extra_waves}</p>"; ?> </div> </div> </section> </div> <script type="text/javascript">var waves = <?php echo "{$extra_bodies->extra_waves}";?>; if (waves = 0) document.getElementById('svg_waves').style.display = "none"</script> <div class="svg_waves"> <svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 1440 157"> <g id="footer_wave" fill="none"> <g id="Artboard" fill="<?php echo "{$extra_bodies->extra_wave_color}" ; ?>"> <g id="waves" transform="matrix(-1 0 0 1 1649 31)"> <path id="wave--bg" d="M62.871 104.03C216.871 87.324 286 79.324 589 79.324S958 125 1249 125s445.587 1 445.587 1L1678 225 183.67 235.324S-91.129 120.734 62.871 104.03z"/> <path id="wave--bottom" d="M72.868 151.295C103.996 138.363 484.122 47.5 650.155 47.5c166.034 0 320.54 45.056 611.54 45.056 291 0 464.044-67.495 464.044-67.495l-80 132.939-1437 32s-167-98.777-135.871-111.71v73.005z" opacity=".06" transform="matrix(-1 0 0 1 1794.739 0)"/> <path id="wave--middle" d="M43 2c154-9.807 423.81 29.65 538.81 45.5C696.81 63.35 966 94 1257 94c291 0 457.203-42.22 457.203-42.22l-69.753 97.447H201.001S-111 11.807 43 2z" opacity=".15"/> <path id="wave--top" d="M616.074 103.938c-293.347 0-472.782-20.373-472.782-20.373l70.315 97.447h1455.087s329.601-143.286 174.36-153.093c-155.242-9.807-605.136 26.69-721.063 42.54-115.927 15.85-212.571 33.479-505.917 33.479z" opacity=".1"/> </g> </g> </g> </svg> </div> </div> <?php } ?>
  6. Hi, I have a small module I created that copies across field content from one page to multiple other pages. I just added a repeater field and while it copies across to the other pages it has caused timeout/memory issues with PHP. I think this is because of the multiple fields within the repeater (title, text caption, image) each being copied multiple times. I thought one way to help would be to not copy images across as they're not needed in the other pages. However I'm unable to figure out how to copy a repeater field excluding one field within the repeater itself. This is my current code: // Inline gallery 1 if(count($page->article_inline_gallery_1)) { $translation->of(false); $translation->article_inline_gallery_1->removeAll(); $gallery = $page->article_inline_gallery_1; foreach($gallery as $item) { $translation->article_inline_gallery_1->import($item); $translation->save("article_inline_gallery_1"); } } At the point that each repeater imported as a whole ->import($item) could anyone help to exclude one of the fields within the repeater?
  7. How can I execute a php script like echo "hallo world"; within a process-wire site. I copied the php script, but only the text command of the php scripts was displayed on the fronted.
  8. Hi, I'm trying to write a bash script that automates our release procedures. 1 of the things I've written is a php module that clears the Procache settings and resets. The php module runs if I call it from a browser but if I call it from a bash script I get a connection refused error. Error: Exception: SQLSTATE[HY000] [2002] Connection refused (in /Users/FrancisChung/Sites/Develop/wire/core/ProcessWire.php line 293) This error message was shown because: you are using the command line API Error has been logged. Assuming this is a security precaution, I was wondering if there is a different way around this? Perhaps write a container php module that launches the bash scripts instead?
  9. Hello everyone, this is my first post here, and i hope its the right place for my question. I am getting started with PW and right now, im trying to bring a existing static Site to PW In this static site i was working with some PHP to import svg code echo file_get_contents("img/icons/ticket.svg") I placed the img folder in the assets folder but now i am having troubles to point at this file using $config->urls->assets i was trying to do something like echo file_get_contents("$config-urls-assets/img/icons/ticket.svg") but of course this fails and as i am not quite good with PHP i do not know how to nest this php to get what i want. I don`t want to use fields to store the svg code, because i need different icons on one page and i do not want to create multiple field for that. Any advice is highly appreciated. Thank you.
  10. 777 seems excessive - is there something that I'm missing here? This is a print out of the /site content; ``` total 28 drwxrwxr-x 6 geot geot 4096 Sep 9 13:30 . drwxrwxr-x 8 geot geot 4096 Sep 9 13:17 .. drwxrwxr-x 2 geot geot 4096 Sep 6 10:10 assets -rwxrwxrwx 1 geot geot 1548 Sep 6 10:10 config.php drwxrwxr-x 3 geot geot 4096 Sep 6 10:10 install drwxrwxr-x 2 geot geot 4096 Sep 6 10:10 modules drwxrwxr-x 5 geot geot 4096 Sep 6 10:10 templates ``` I'm sure that I shouldn't have to have permissions so high, but I'm pretty new to this. Here's a shot of the setup that I'm currently going through; http://imgur.com/a/WkhAX You can see that the error (for site/config.php) is no longer there with these permissions, but they still 'feel' wrong. Thanks
  11. i'm getting a "Fail: GD 2.0 or newer" warning message from a processwire checks... I've tried to update with; `sudo apt-get install php-gd`. Refreshing the check message throws the same error up though... I'm running `PHP Version 7.0.8-0ubuntu0.16.04.2`. Here's a screenshot of the error that I'm referring to http://imgur.com/a/erDEk
  12. Hi everyone, I am having difficulties using the blog module and was wondering whether someone could enlighten me. I have got a grid which has all my posts on (which I will refer to as post menu, for lack of a better description) and I would like to attach and image to each (like a thumbnail) with the post title as an overlay. Where the blue rectangle is on the attached image. I have attached and image to each post and I'm trying to call them. However I have since realised from receiving a blank result that I need to call them from another page (from the post to the post menu). You'll have to excuse my lack of knowledge for PHP and the PW calls, but I have found it really difficult to understand how this module is set up. I also apologise if I've posted this in the wrong category. Does anyone what I need to produce this? I have tried some of the below but doesn't bring back what I am after. Thanks, Matt <!-- Attempt 1 --> <?php echo " <script> $(document).ready(function(){ $(\".post-headline\").css(\"background-image\", \"url('"; echo $image; echo "')\"); }); </script>"; ?> <!-- Attempt 2 --> <style> .post-headline { background: url("<?php foreach($page->blog_images as $image){ echo "{$image->url}"; } ?>"); } </style> <!-- Attempt 3 --> <div style='background-image: url( <?php foreach($page->blog_images as $image){ echo "$image->url"; } ?> )'><div>
  13. After getting a lot more confident with my php skills, I thought I would try condensing my file structure by using the _func.php in my templates. I thought this would be a great way to cut down on my includes (Currently at around 12). However, I ran into a bit of a snag. From my reading, I understand that $page is not a global variable, and that I could use something like: $pages = wire('pages'); to get the desired result. However, I must not be using this right :). Here Is what I have: function basicPage(){ $pages = wire('pages'); $output = ""; $output .="<div class=\"container\">"; $output .="<div class=\"row\">"; $output .="<div class=\"col-md-12\">"; $output .="<h1><?php echo $page->title; ?></h1>"; $output .="</div>"; $output .="</div>"; $output .="<div class=\"row\" id=\"tinyInfo\">"; $output .="<div class=\"col-md-12\">"; $output .="<ul class=\"about\">"; $output .="<li>{$pages->about}</li>"; $output .="</ul>"; $output .="</div>"; $output .="</div>"; $output .="<div class=\"row\">"; $output .="<div class=\"col-md-12\" id=\"maincopy\">"; $output .="{$pages->maincopy}"; $output .="</div>"; $output .="</div>"; $output .="<div class=\"row\">"; $output .="<div class=\"col-md-12\">"; include './includes/slider.php'; $output .="</div>"; $output .="</div>"; echo $output; } This doesn't seem to be outputing anything into my template. Have I missed a crucial step here, or is the "output" method I have chosen not even a great way to set this up? I understand includes wont work this way, but if anyone has suggestions on this I would gladly like to hear them. Sorry for a post with so many questions, but I am just stumped.
  14. Hi everyone, I am trying to create a gallery of tiles where the user can click a tile and it will open another set of images that are unique to that tile. So a page of albums. I am using repeaters so that the user can add albums, without having to create fields or pages. However I am struggling to separate the albums into the desired tile, since at the moment all the albums I have uploaded to PW come back. Generally my code is quite messy and I haven't coded some elements that I have described. Since I was unsure how to progress, I was experimenting with things like having each album having an number so that I could Identify them. Also I am using UIKit for scrolling through the album. See code below. <?php include("./head.inc"); ?> <!--Image Viewer--> <div id="back" class="back"> <a href="javascript:void(0)" onclick="closeAlbum()" class="material-icons">close</a> <div class="uk-container uk-container-center"> <div class="uk-container uk-container-center uk-width-3-4"> <div id="slideshow" data-uk-slideshow="{autoplayInterval:1000}"> <div class="uk-slidenav-position"> <ul class="uk-slideshow"> <?php $i=1; foreach ($page->album_repeater as $item) { echo "<li class='album-$i'>"; foreach ($item->album_images as $image) { echo "<li>"; echo "<img src='{$image->url}'>"; echo "</li>"; } $i++; } echo "</li>"; ?> </ul> <ul> <a href="" class="gl uk-slidenav uk-slidenav-contrast uk-slidenav-previous" data-uk-slideshow-item="previous"></a> <a href="" class="gl uk-slidenav uk-slidenav-contrast uk-slidenav-next" data-uk-slideshow-item="next"></a> </ul> </div> </div> </div> </div> </div> <!--Album Thumbnails--> <div id="content" class="uk-width-1-1 uk-grid" style="min-height: calc(100% - 100px);"> <div id="gallery" class="uk-width-8-10 uk-container-center uk-flex uk-flex-center uk-flex-middle uk-grid" data-uk-grid="{gutter: 20}"> <?php $th = ""; foreach($page->album_repeater as $item){ $th .= "<div class='gallery-item uk-width-small-1-2 uk-width-medium-1-3 uk-width-large-1-6'>"; $th .= "<a id='thumb' class='uk-panel' onclick="; $th .= "'openAlbum()'"; $th .= "><img src='{$item->album_images->first()->url}'>"; $th .= "</a>"; $th .= "</div>"; } echo $th; ?> </div> </div> <script> function openAlbum() { document.getElementById("back").style.display = "block"; document.getElementById("thumb").style.display = "none"; document.getElementById("content").style.display = "none"; } function closeAlbum() { document.getElementById("back").style.display = "none"; document.getElementById("thumb").style.display = "block"; document.getElementById("content").style.display = "block"; } </script> <?php include("./foot.inc"); As a visual aid I've attached screenshots of what the code produces. First Image is the album where you can slide through the images. The second is the tiles that when clicked open the associated album. Does anyone know any solutions or existing gallery's similar to the idea above (preferably tutorials). Thanks, Matt
  15. I have an event page were you can select multiple sub-categories with a page field using checkboxes. Now i want to display all the sub-categories but also have them sorted by their parent category. I tried something lik below but that didn't work. $tags = $event_cat->find("sort=$event_cat->parent"); foreach ($tags as $tag){ echo $tag; } Any ideas?
  16. Hi, I am looking for a new cms to devellop the new version of my site. I have used joomla and modx but it was not really for me. maybe processwire is more for me? Can I do the following with this CMS? Use data in an external database (same server or other then site) to populate data on pages. (lists and detail pages) Add, delete, adapt entries in that database (through forms on frontend of the site) use my php and sql “knowledge” to adapt/create the above. (create custom php forms and php pages) create a multinlangual site (easy to add a language/tanslate file to be able to add languages) (optional: give users the option to use facebook/google or site registration) This for an event database website where: there is a hierarchical category system users can create an account/change their password logged in users can add/update/delete and search events. visitors (also not logged in) can add,search events. normal users can only acces front end even when logged in admin users can acces front and back end tnx for any replies
  17. Jeffrey Way, from the excellent Laracasts.com, just published a free series for PHP beginners: https://laracasts.com/series/php-for-beginners From the website: Jeffrey is a great teacher so if you are learning PHP, no better place you'll find.
  18. I wasnt quite sure where to post this (perhaps the AIOM thread is the correct place, if so I am sorry).. But I have a switch statement set up on certain values in an options. I have that part working like a charm.. However, when I echo: echo "<link rel=\"stylesheet\" href=\"{AIOM::CSS(array('styles/style.css', 'styles/slider.css', 'styles/style2.css', 'styles/style4.css'));}\">"; It just returns a link. It is like it is rendering one linked file and I receive a 404 error. DId I escape the "" the wrong way? switch ($switchColor) { case "Style3": echo "<link rel=\"stylesheet\" href=\"{echo AIOM::CSS(array('styles/style1.css', 'styles/slider.css', 'styles/style2.css', 'styles/style3.css'));}\">"; break; case "Style4": echo "<link rel=\"stylesheet\" href=\"{echo AIOM::CSS(array('styles/style1.css', 'styles/slider.css', 'styles/style2.css', 'styles/style4.css'));}\">"; break; default: echo "<link rel=\"stylesheet\" href=\"{echo AIOM::CSS(array('styles/style1.css', 'styles/slider.css', 'styles/style2.css', 'styles/normal.css'));}\">"; } I should have actually tried assigning it to a variable and then passing that in to the switch before I posted this. I solved it by assigning the AIOM array to a variable. So apparently that isnt working either.
  19. Ok, so I have the following phpMailer script that works perfectly. However, I also need this to send a completely different email to the person who filled out the form with basic instructions. I am very new to phpmailer (much quicker and easier to work with). Just to lay it all out what I am trying to accomplish: On submit, the php submits the form data to myself via email, but at the same time it sends another email to the user who completed the form with instructions. Has anyone accomplished anything like this before? <?php require("class.phpmailer.php"); require_once('class.smtp.php'); $mail = new PHPMailer(); $mail->IsSMTP(); // telling the class to use SMTP $mail->SMTPAuth = true; $mail->Host = "********.****"; $mail->Port = *****; $mail->IsHTML(true); $mail->Username = "******"; $mail->Password = "**********"; $mail->From = "*******@********.com"; $mail->AddAddress("*****@****.***"); $field1= Trim(stripslashes($_POST['firstName'])); $field2= Trim(stripslashes($_POST['lastName'])); $field3= Trim(stripslashes($_POST['emailAddress'])); $field4= Trim(stripslashes($_POST['phoneNumber'])); // Email body text $mail->Subject = "First PHPMailer Message"; $mail->Body .= "First Name: $field1"; $mail->Body .= "Last Name: $field2"; $mail->Body .= "Email Address: $field3"; $mail->Body .= "Phone Number: $field4"; if(!$mail->Send()) { echo 'Message was not sent.'; echo 'Mailer error: ' . $mail->ErrorInfo . $mail->SMTPDebug = 2; } else { echo 'Message has been sent.'; } ?>
  20. Hello there This is a very overall question.... I am fairly new to CMS and PHP, but I am managing the essentials. Still, I am struggling with PHP. I worked through quite some youtube tutorials and my brain is beginning to adapt, but the theory is a little different than the practice. All the pieces are there, but I have trouble putting them together. Is there a nice tutorial to train processwire specific PHP? How can I get prolific in PHP for PW? Theres tons of overall PHP lessons, but I am looking for something tying into PW. Programming is new to me ( coming from the design side ) and it opposes me quite hard I would be very thankful for any suggestions Thanks Jakob
  21. I'm sorry if this is dumb question, but I've been trying to find out what gets executed each time PHP serves a page. The specific scenario is that I'm implementing a LazyCron hook and can put it multiple places - an autoload module, init.inc, site/ready.php, etc. It has a fair amount of logic to load that I'd prefer not be in every page. The only way I can see to prevent that code from being loaded and interpreted (not necessarily executed) is to create a special page for it and use a cron job to kick it off only in that page's template. It seems like ALL autoload modules, init.inc, main.inc, site/ready.php, etc. get loaded and interpreted every page load (unless init.inc is disabled for that template, etc.) So 1. does everything get loaded and interpreted every page load or is caching of code done in some way (not just the file)? 2. is there a better way to avoid loading significant amounts of code than associating it with a specific page? Let me know if this isn't clear.
  22. i have problem with send muliple files, for one file it works, for multiple not, what should I do with this code ? <?php if($_POST){ unset($_POST["send"]); //print_r($_POST); unset($_POST["pliki"]); $p = new Page(); $p->template = 'page'; $p->parent = '1043'; $p->user_id = $user['id']; foreach($_POST as $v=>$pr){ if($pr!=''){ $p->{$v} = $pr; } } $p->save(); $pp = $pages->get($p->id); $pp->setOutputFormatting(false); if(isset($_FILES['pliki'])){ $errors= array(); $file_name = $_FILES['pliki']['name']; $file_size =$_FILES['pliki']['size']; $file_tmp =$_FILES['pliki']['tmp_name']; $file_type=$_FILES['pliki']['type']; $file_ext=strtolower(end(explode('.',$_FILES['pliki']['name']))); //$name = strtolower($sanitizer->name($file_name)); //'../../site/assets/files/'.$p->id.'/'.$name) $expensions= array("jpeg","jpg","png","docx","doc","pdf"); if(in_array($file_ext,$expensions)=== true){ move_uploaded_file($file_tmp,"../../site/assets/files/".$pp->id."/".strtolower($sanitizer->name($file_name))); $pp->pliki->add($file_name); } } $pp->save(); } ?> My input looks like this: <input type="file" id="pliki" name="pliki[]" multiple>
  23. Hi folks, I want to pass some PHP arrays to JSON. I am managing to do this fine but the issue is that it wraps [] round the array, whereas I need it without [] to use it as geojson within Mapbox (https://www.mapbox.com/mapbox-gl-js/example/popup-on-click/). <?php $programme_array = array(); $programmes = $pages->find('parent=programme, sort=sort'); foreach ($programmes as $programme) { $title = $programme->title; $url = $programme->url; $summary = $programme->programme_summary; $image = $programme->programme_venue_image->url; $long = $programme->programme_location->lng; $lat = $programme->programme_location->lat; $programme_array[] = array( 'type' => 'Feature', 'geometry' => array( 'type' => 'Point', 'coordinates' => [$long,$lat] ), 'properties' => array( 'title' => $title, 'description' => $summary, 'image' => $image, 'url' => $url, "marker-symbol" => "music" ), ); } $programme_json = json_encode($programme_array, true); ?> [{"type":"Feature","geometry":{"type":"Point","coordinates":["-1.466439","53.376842"]},"properties":{"title":"Site Gallery","description":"Duis arcu tortor, suscipit eget, imperdiet nec, imperdiet iaculis, ipsum. Donec id justo. Aenean tellus metus, bibendum sed, posuere ac, mattis non, nunc. Suspendisse feugiat. Etiam rhoncus.","image":"\/Freelance\/art-sheffield-2016\/site\/assets\/files\/1032\/site_gallery.jpg","url":"\/Freelance\/art-sheffield-2016\/programme\/site-gallery\/","marker-symbol":"music"}},{"type":"Feature","geometry":{"type":"Point","coordinates":["-1.477881","53.374798"]},"properties":{"title":"Moore Street Substation","description":"","image":null,"url":"\/Freelance\/art-sheffield-2016\/programme\/moore-street-substation\/","marker-symbol":"music"}},{"type":"Feature","geometry":{"type":"Point","coordinates":["-1.459620","53.380562"]},"properties":{"title":"S1 Artspace","description":"","image":null,"url":"\/Freelance\/art-sheffield-2016\/programme\/s1-artspace\/","marker-symbol":"music"}}] Any thoughts? I know this is perhaps more PHP/JSON related question than a PW question but I just wanted to make sure I had this set up correctly.
  24. I know that the Topic title is probably confusing(sry for that ). Let me explain my Question: I have two Filters(Main Filter & Detail Filter) like you can see below. When I click on a main filter it gets bold and will be added to the "Meine Auswahl(my selection)" container below the Filters. When I click on the "X" span inside the "My Selection" Container, the selected Filter gets resetted. Now, what I want to achieve is a ajax Filter which changes the php Selector for the for the $pages->find(). For Example: When I come to that page, the selector for the main and detailfilter should look like this: $branches = $pages->find("template=branch"); // Main Filters <?php $genres = $pages->find("template=genre, select_sparte=''"); ?> //Detailfilters (Returns a NullPage so dont show the Detailfilters when none main filter is selected) When I select for e.g Example Filter 1 it should change to this without a page refresh: <?php $genres = $pages->find("template=genre, select_sparte.title='Example Filter 1'"); ?> So that I get the Detail Filters of Example Filter 1 without a page refresh. Is this even possible? When yes how, can you guys show me a direction?
  25. Hello again. Thought i share my way of creating sliders in my ProcessWire websites, by using the images field type and some HTML, JavaScript, CSS and a pinch of love. Step One: Go to http://flickity.metafizzy.co/ and download Flickity slider. They also have a CDN option for thoose who prefere that. Also have the page handy cause it has alot of usefull info for configuring the slider and such. Note: In my example i use jQuery to initialize Flickity but you can use it without, see the website for more info. So you need to load jQuery before flickity in the header section for my example to work. Step Two: Here is an example of how you could write some code and HTML for your template file where the slider should render. This code assumes your images field is named images. <div class="slider-container"> <?PHP /* check if there is any images to display */ if(count($page->images) > 0) { /* render out the images and resize to 700 pixel width */ foreach($page->images AS $key => $image) { echo('<img src="' . $image->width(700)->url . '" class="slider-container-item" alt="' . $image->description . '">'); } } else { echo('<p>Houston we have a problem...there are no images to see here...</p>'); } ?> </div> Also lets put together some simple CSS for our container and items. Alter it to your own needs and preference. For the Flickitys sliders default CSS and configuring see the website. .slider-container { position: relative; display: block; overflow: hidden; width: 100%; max-width: 700px; padding: 0; margin-bottom: 15px; clear: both; } .slider-container-item { position: relative; display: block; width: 100%; height: auto; max-width: 700px; } Step Three: Put the default CSS and also Flickitys JS files and load jQuery before Flickity in the header of your site so that flickity works as intended. Or use the CDN option mentioned on the flickity website. <link rel="stylesheet" href="/path/to/flickity.css" media="screen"> <script src="/path/to/jquery.js"></script> <script src="/path/to/flickity.pkgd.min.js"></script> Don´t forget to put the Flickity JavaScript initalization code at the bottom of the template file. For all the Options and configuration see the website: http://flickity.metafizzy.co/ In the example code below i use just a few of the many options. <script type="text/javascript"> /* initiate Flickity Slider JS */ $(document).ready(function(e){ $('.slider-container').flickity({ // options cellSelector: '.slider-container-item', cellAlign: 'center', imagesLoaded: true, percentPosition: true, contain: true }); }); </script> Note: This is my prefered way of doing it. But there are alternative ways to initialize Flickity if you read the info on the website. This should be enough to get you started. And with a little imagination i think you could see the potential. Good luck with all your Slider making dreams
×
×
  • Create New...