-
Posts
516 -
Joined
-
Last visited
Everything posted by louisstephens
-
So I created a settings page in the admin (process set to PageEdit and chose a page from the tree with the desired template), but now I am a little confused of how to actually pull out the data that I need. I had tried: <?php echo $page->settings->body; ?> but this produces nothing. I am sure I have overlooked something very easy here, but for the life of me I cant figure it out.
-
This is awesome! I havent given it a proper look through, but I was wondering if there is a quick and easy way to translate this to english? Google Translate works on the frontend, but the backend it doesnt seem to at all.
-
To be honest, I am loving the D.O.F. that can be assigned to elements via classes. However, I have found that materialize is much more "opinionated" about how buttons, forms, cards, etc etc display and function (more of a UX framework) where I feel bootstrap is a lot more forgiving on these. I am still picking through it all, but I have seen that there is some overlap between the two. I will definitely have an update later this week once I am able to dive further into it.
-
I have been using Materialize in some of my recent local testing environments and thus far I am loving it. It does seem very similar to bootstrap, but I am enjoying it more. I have not yet tried throwing it (or any grid system) into the admin area. Has anyone done this with success?
-
Thanks BitPoet.. I never knew that was an option. I really appreciate the help!
-
The current use of relative urls (in my opinion) is great. However, I have a project that requires image paths to be absolute (using the source code module so the code can be dropped in different pages outside of processwire), ie: http://example.com/files/1024/fileName.jpg . Is this possible to do in processwire? I had searched around but couldn't find anything regarding the topic. Sorry, I forgot to post this. I am currently calling images like so: <?php echo $page->headerImg->url; ?> which produces: <img src="/testing/site/assets/files/1035/header.jpg" >
-
Kongondo, I had a d'oh moment, but I appreciate the quick response. I really felt dumb there ha ha . I realized I wasn't actually comparing it to anything so I changed it to: <?php $styleSwitcher = $pages->get('/url-one/'); $baseURL = $page->url; if($styleSwitcher == $baseURL){ echo "<link rel='stylesheet' href='{$config->urls->templates}css/one.css' />"; } else{ echo "<link rel='stylesheet' href='{$config->urls->templates}css/two.css' />"; } ?> And with that, problem solved. I actually think I understand the find/get for $pages a lot better as well (did a lot more reading).
-
I thought I had this, but I guess my understanding of get/find for pages is a bit lacking (or perhaps nonexistent). I am trying to switch the stylesheet based on the URL using a simple if/else statement, but what I wrote doesn't seem to be doing the job. I currently just have two pages (that each need two different background images), but they share the same head.inc file. I wrote: <?php // Switch stylsheets based on site $styleSwitcher = $pages->get('/url-one/'); if($styleSwitcher){ echo "<link rel='stylesheet' href='{$config->urls->templates}css/one.css' />"; } else{ echo "<link rel='stylesheet' href='{$config->urls->templates}css/two.css' />"; } ?> I assume I messed up my "get" as both pages are still loading one.css
-
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:
-
Has anyone used the import xml to pages module to create pages automatically? Ie, auto run every day or so to create new pages?
-
"Inserting" Other field into foreach
louisstephens replied to louisstephens's topic in API & Templates
Thank you everyone. I finally got it all working for me. I appreciate all the help -
Ok, I am having some issues with this menu (will be in bootstrap). I currently have: <?php $nav = $modules->get("MarkupSimpleNavigation"); function hookGetListClass(HookEvent $event){ $child = $event->arguments('page'); // current rendered child page $class = $event->arguments('class'); // the class string already present $options = array( 'has_children_class' => 'dropdown', 'outer_tpl' => '<ul class="nav">||</ul>', 'inner_tpl' => '<ul class="dropdown-menu">||</ul>' ); // any check on that child to set your custom class if($child->id == 1001){ $event->return .= " inner"; // add your custom class to the existing } } // setup the hook after on ___getListClass($class, $page) method $nav->addHookAfter('getListClass', null, 'hookGetListClass'); echo $nav->render($options); ?> However, the nav doesnt seem to be taking the options, and is instead using the "has_children" class. I saw a post almost exactly like this, but couldnt get the outcome. The inner ul should have a class of "dropdown".
-
If Page is selected, display Output
louisstephens replied to louisstephens's topic in API & Templates
I do apologize Ivan. Let me try to clear up what I am trying to do. Ill start by breaking the frontend up from the backend. Backend: I have a pageField (that is inside a repeater with 3 other fields) that allows a user to select only one page from the page tree which the template will use to grab the link to: <a href="$page->pageField->url;>Link to Selected Page</a> So basically, the repeater is set like: pageRepeater - FieldOne - FieldTwo - FieldThree - pageField Front End (template): My template was set like: <?php foreach($page->pageRepeater as $myVariable) { echo "<img src='{$myVariable->fieldOne->url}' class='img-responsive' />"; echo "<p>{$myVariable->fieldTwo} AS SHOWN</p>"; echo "<p>{$myVariable->fieldThree}</p>"; echo "<a href='{$myVariable->pageField->url}'>Link to Selected Page</a>"; } ?> All of this worked quite well, however I ran into one small issue. Occasionally, the user will not need the pageField, and will not won't the "Link to Selected Page" to display on site. I had thought that I could use an if/else statement to display the link only if a page is selected. Which is why I was trying to figure out if a page was selected. 1. check if a page is selected using pageField 2. if a page is selected: "grab the pages url" and display the link on the frontend. 3. if a page is not selected: do not display the link on the frontend I should have been a lot more clear when I originally wrote the post, but I had a lot running through my head regarding the if/else statement. I have updated the original post with this information. -
If Page is selected, display Output
louisstephens replied to louisstephens's topic in API & Templates
Hmm, Ill have to play around with this. foreach($page->pageField as $testing) { echo "<div class='mix col-xs-12 col-sm-6 col-md-3 '><img src='{$page->pageField->url}' class='img-responsive' />"; if($page->pageField->has($page)){ echo "test"; } else { echo "bob"; } } It seems like it is not outputing anything at all now (currently do not have any page selected). -
If Page is selected, display Output
louisstephens replied to louisstephens's topic in API & Templates
I am sorry Ivan, I should have clarified a lot more on that. I need to check to see whether a page has been selected using the pagefield and it is set to "Single Page or empty page when none selected" -
**Let me try to clear up what I am trying to do. Ill start by breaking the frontend up from the backend. Backend: I have a pageField (that is inside a repeater with 3 other fields) that allows a user to select only one page from the page tree which the template will use to grab the link to: <a href="$page->pageField->url;>Link to Selected Page</a> So basically, the repeater is set like: pageRepeater - FieldOne - FieldTwo - FieldThree - pageField Front End (template): My template was set like: <?php foreach($page->pageRepeater as $myVariable) { echo "<img src='{$myVariable->fieldOne->url}' class='img-responsive' />"; echo "<p>{$myVariable->fieldTwo} AS SHOWN</p>"; echo "<p>{$myVariable->fieldThree}</p>"; echo "<a href='{$myVariable->pageField->url}'>Link to Selected Page</a>"; } ?> All of this worked quite well, however I ran into one small issue. Occasionally, the user will not need the pageField, and will not won't the "Link to Selected Page" to display on site. I had thought that I could use an if/else statement to display the link only if a page is selected. Which is why I was trying to figure out if a page was selected. 1. check if a page is selected using pageField 2. if a page is selected: "grab the pages url" and display the link on the frontend. 3. if a page is not selected: do not display the link on the frontend I should have been a lot more clear when I originally wrote the post, but I had a lot running through my head regarding the if/else statement. I have updated the original post with this information.
-
"Inserting" Other field into foreach
louisstephens replied to louisstephens's topic in API & Templates
Yeah, to be honest I dont know what was wrong with it. It was set on asm multi select so I did change it to "single". However, after deleting the field and setting up a new one it seems to be working now. I have it back on my local set up trying to figure out why it "broke". -
"Inserting" Other field into foreach
louisstephens replied to louisstephens's topic in API & Templates
Thanks Kongondo. That was exactly what I needed. However, I think I might have goofed somewhere. I can pull in Link#3 just fine, but when I attempt to pull the first link (page field) I can get the id. Using ->url doesnt seem to be working for me. Perhaps I used it in the wrong location? <?php $myFirstLink = $page->sideBarURL1->url; //however you got it $myThirdLink = $page->sideBarURL3;// however you got it $out = ''; $i = 1; foreach($page->selectHeader->pageSidebar as $sideNav) { if($i == 1) $out .= "<li><a href='{$myFirstLink}'>{$whateveYouWantHere}</a></li>"; if($i == 2) $out .= "<li><a href='{$myThirdLink}'>{$whateveYouWantHere}</a></li>"; $out .= "<li><a href='{$sideNav->sidebarURL}' >$sideNav->sidebarTitle </a></li>"; $i++; } echo $out; ?> -
I had a sidebar template set up with a repeater (as it needed to display links offsite) and everything was going smoothly: <ul class="sideNav" data-spy="affix" data-offset-top="490" > <?php foreach($page->selectHeader->pageSidebar as $sideNav) { echo "<li><a href='{$sideNav->sidebarURL}'' >$sideNav->sidebarTitle </a></li>"; } ?> </ul> The repeater was set to include 2 fields (the link title and link URL) and output it in my template (usually constrained to 8 links). However, I now realize that I must remove the 1st and 3rd links and put them in another template as they are dependent on the page (and cant just be entered manually. My question, is it possible to inject the two links into the foreach loop so that they still appear in the 1st and 3rd spot respectfully? The two were changed to a page select, but I didnt know if that was even possible to achieve. I was hoping that I didnt have to create 8 separate fields to achieve the desired result.
-
Gallery "Deleting" images from multi upload
louisstephens replied to louisstephens's topic in API & Templates
Ah ha. That was the issue. I cant believe I overlooked that. Thanks again LostKobrakai! -
Gallery "Deleting" images from multi upload
louisstephens replied to louisstephens's topic in API & Templates
Ah, thanks Martijn. I even noticed that uploaded 2 at a time would result only in 4 being saved (not the full 8). Did something transpire from 2.7 to 2.7.2 ? -
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?
-
I just experienced this issue for myself today. I tried uploading 10 images, and it will only "Save" 5 of them. It also seems like it isnt saving them in the order of upload (it appears to be pretty random).
-
Thanks elabx. I finally got it working.
- 13 replies
-
- 1
-
-
- navigation
- child
-
(and 1 more)
Tagged with:
-
So just so I understand this, you are saying something like: $pages get(parentName)->siblings as $child How would this work though if you were dynamically trying to code this if there would be multiple "parentNames"? Sorry, I am just trying to get a grasp on all of this. I appreciate your help @tom @horst and everyone else. Thank you a bunch
- 13 replies
-
- navigation
- child
-
(and 1 more)
Tagged with: