Jump to content

asbjorn

Members
  • Posts

    179
  • Joined

  • Last visited

  • Days Won

    1

Everything posted by asbjorn

  1. I have a site with multiple subsites (for sub-organization under our main organization) on the same install. Simple stuff really, and useful because I have news/events that these have sub-organizations have common. Therefore I also have common categories. But I want to tag the news based on where their main location is. (So that people now they will be directed to another sub-organization if they click on a link with a tag). My site structure: Home -Site A --News -Site B --News -Site C --News -Categories --Cat 1 --Cat 2 On each site (Site A, Site B and Site C), I have a code for foreaching selected categories, it goes like this: <?php $ids = $page->show_news_cat; $nnow = time(); $news = $pages->find("template=news-post, show_news_cat={$ids}, limit=3, date_publish<$nnow"); foreach ($news as $new) // If unpublish has a date if($new->date_unpublish != "") { if(time() > $new->getUnformatted('date_unpublish')) { $new->of(false); $new->addStatus(Page::statusHidden); $new->save(); } } echo "<div class='col-md-4'>" . "<a href='{$new->url}'><h2>{$new->title}</h2></a>" . date("d. F Y", $new->date_publish) . "</div>" ; ?> E.g. I would want to tag news located in Home>Site A>News with "Site A", if I am currently browsing on Site B or Site C. I looked around the forum and tried this and that, but with no luck. If nothing fancy works, I could always have my code check if url/path for each news contains "site-a" or "site-b", and then output something based on that. But I never found the right functions for that. Could someone help to point me in the right direction. (IF you have other comments on the code above, I am not one for saying no thanks to improvements. I never learnt php proper.)
  2. Hi. What is the current status on this project? I just recently discovered this post, and the modules looked both promising and something I would have much use for on my current website project.
  3. I have read and re-read the first post so many times I was getting blind. I never saw the code under Checking for a unique username. With that included, I got it working. I should really read better on my own in the future! Thanks, cstevensjr, horst and pwFoo!
  4. Thanks, cstevensjr. Here's my code from my template "registration-page": Code has been removed by me to clean up this forum post a little. All that was missing was a section of code inlcuded in the first forum post (that the original poster had moved to functions.php). So it was not really a problem I have removed the include functions (don't know what it is for) and the require phpmailer, and have setup WireMailSwiftMailer instead. Therefore I have also changed some lines from $mail = new wireMail(); I have added new fields to the system template user, which is why I have first name and last name in here. I am running my test site on a MAMP installation. The error that show in errors.txt is (lines should match up with the pasted code): 2015-04-18 21:44:50 guest http://localhost/registration/ Error: Call to undefined function username_validation() (line 102 of /Applications/MAMP/htdocs/sitename/site/templates/registration-page.php) I think that's most of it.
  5. I've been trying for a couple of hours to set this up. But for the last hour it has given me an "Internal Server Error". The error log says "Error: Call to undefined function username_validation()". I have no idea what could be wrong. I have not included any functions.php file, as I do not have one or do not have any idea what code that should contain. I could paste more code, or tell more about my setup, but I'll start with the error.
  6. Thank for you reply, Macrura. I also tried what you suggested, but without any luck. I am not able to get the name with that code line. I only get the ID from $menuname, using this line: $menuname = $page->show_menu; The Menu Builder module page says I can render with the ID. But I do not get it to work with this line: echo $homemenu->render($menuname, $options); I get it to work with this: echo $homemenu->render(1045, $options); where 1045 is the ID for home-menu.
  7. Background I have a home.php template in which I have a dropdown select box. From this dropdown I am able to choose between my menus. I have Menu Builder installed. I created a field type with the name show_menu and type Page. Then I set the Menu Builder folder as parent of selectable pages. Back end / admin It seems to work back end. All my menus are listed when I edit a page that has the home.php template. Front end / home.php Here is my problem. I am trying to get the name from the selected menu (from back end) to show in my code. For a while I was able to get the ID, then I got all 3 IDs (I have 3 menus to choose from). The menu I want to show is named home-menu, labeled Home Menu. In the following code I have included both a non-working line as line 16. And a working line as line 17. But line 17 is "manual" and not connected to the back end editing, which is what I am trying to do. So can anybody help me with the right code line to output the name for Home Menu? (I tried to work with the ID, but got fatal errors. Those errors disappeared when I manually use line 17.) <?php $homemenu = $modules->get('MarkupMenuBuilder'); $menuname = $page->show_menu->select_value; $menuname = "home-menu"; $options = array( 'has_children_class' => 'has_children', 'current_class' => 'current', 'menu_css_id' => $menuname, 'menu_css_class' => 'nav', ); echo $homemenu->render($menuname, $options); ?> Btw. I am no PHP guru, I get by mostly through copy/paste simple snippets. Please ask me if I lack any details or am unclear on my problem. This is my first post, so please correct me if I am posting wrong or something.
×
×
  • Create New...