Jump to content
franciccio-ITALIANO

To add 3 url-link field to same template

Recommended Posts

Hi, I read this: https://processwire.com/api/fieldtypes/repeaters/

I would like to put 3 same field link to same template, but in processwire I can put only 1.
The modules repeaters can help me?
I see the video and seem no, because I want add the SAME FIELD, not another o a group of another link.
 

Someone can help me?

 

 

Share this post


Link to post
Share on other sites
34 minutes ago, franciccio-ITALIANO said:

The modules repeaters can help me?

Yes...unless am misunderstanding you. 

If you have a repeater with these 3 fields: 

Email (email) Phone (text) Address (text). When editing the page, you can have these repeated as many times as you want, e.g.

  1. Email (email) Phone (text) Address (text)
  2. Email (email) Phone (text) Address (text)
  3. Email (email) Phone (text) Address (text)
  4. Email (email) Phone (text) Address (text)

Is that what you meant?

Share this post


Link to post
Share on other sites
8 minutes ago, kongondo said:

Yes...unless am misunderstanding you. 

If you have a repeater with these 3 fields: 

Email (email) Phone (text) Address (text). When editing the page, you can have these repeated as many times as you want, e.g.

  1. Email (email) Phone (text) Address (text)
  2. Email (email) Phone (text) Address (text)
  3. Email (email) Phone (text) Address (text)
  4. Email (email) Phone (text) Address (text)

Is that what you meant?

Oh, i checked it, and it's also possible to set the repeater to "min. and max. 3 Values"...
then it looks like this:

5a6f0d8c0ca42_2018-01-2913_02_47.thumb.png.6fd5bb3a333dd49b3b7f196aabd31c01.png

 

And the config:

5a6f0dc2f10ff_2018-01-2913_03_59.png.98f4c50b896b5119108f34e38f139b84.png

Share this post


Link to post
Share on other sites

Hi Zoeck, I seen that modules but I haven't 129€.

Hi, kongondo. I want repeat in a same template, 3 link-url-field, but this links changes page by page.
For example, in a page I put: link A, link B, link C.
In another page, with same first template, i put: link D, link G, link F.

With Processwire I can put in a page only 1 space-field link-url. Or I wrong? 

Share this post


Link to post
Share on other sites
  • Install the "Repeater" Module
  • Create a new Field: Type - Repeater
  • Change "Repeater item visibility in editor" to "Items always open"
  • In this Field, Add one field (your url field) in the details tab and change the value of "minimum/maximum number of items" to 3
  • Add the repeater field to your template ;) 

 

Now you have 3 identical fields in one template... this is the "free" version without the ProFields Module :)

  • Like 1

Share this post


Link to post
Share on other sites
53 minutes ago, franciccio-ITALIANO said:

With Processwire I can put in a page only 1 space-field link-url. Or I wrong? 

That's not correct :) when it comes to repeaters. See @zoeck's step-by-step post above mine. 

Share this post


Link to post
Share on other sites

It depends how you want to use these 3 links in your template(s). You could just as well use a textarea field, and put each URL on a new line. Or you could store links as pages, and use a page references with multiselect. The latter approach would be wise if a link can be used more than once, and has the advantage that you only need to change the link in once place if you come across a broken link sometime in the future.

  • Like 1

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

  • Recently Browsing   0 members

    No registered users viewing this page.

  • Similar Content

    • By Liam88
      Hi All,
      New user over at Processwire and have been rebuilding my site based on this CMS.
      I have been able to find so many answers through Google but I'm a little stuck on this one.
      I have my services page -> services categories -> category children.
      An example of those would be - domain -> services -> ppc -> management
      I also have a set of tags which have different names - services-tag -> grow-your-traffic
      Under these tags I would have multiple links to pages such as ppc, seo, social media and so on.
      A second example would be - services-tag -> convert-your-traffic
      Under here i would have multiple links to pages such as CRO
      Now the set of tags are not visible on-site as they are only created to give overview content to the main services categories.
      Using the categories and the tags I am looking to produce a layout such as (i have also attached an image as an example:
      Tag_1 headline
      Pull all services categories linking to Tag_1
      Tag_1 snippet
      Tag_2 headline
      Pull all services categories linking to Tag_2
      Tag_2 snippet
      So far I have this snippet which is pulling in the tag content but unable to get the posts to show under each of the tags. 
      If i change the if and statement to "tags" instead of "tag" then all posts show under all tags. Where as i want it to show only the posts which are linked to that tag.
      <?php namespace ProcessWire; $tags = $pages->get("/categories-services/")->children(); // Gets the tags $posts = $pages->get("/services/")->children(); // Gets the services categories $link = $tags->ref_6; // Gets the tags and services categories link - under here you have pages_id (services cat id) and data (tags id) // Tag header and summary foreach($tags as $tag) { // This breaks down the tags into sections echo '<section id="services"> <div class="container"> <div class="row"> <h2 class="heading-1"><span>'. $tag->headline.'</span></h2> <p class="mb-5">'. $tag->summary.'</p> </div> <div class="row justify-content-around services">'; // Main services categories that link to the above tags if ($posts->id === $link->pages_id && $tag->id === $link->data){ foreach($posts as $service){ // This pulls in the services categories under the tag header. echo '<div class="card flex-card" id=""> <div class="card-img"> <a href="/'. $service->name.'" title="'. $service->name .'"> <img class="card-img-top" src="../assets/files/'. $service->id.'/'. $service->img_1.'" alt="'. $service->img_1.'" title="'. $service->img_1.'"></a> </div> <div class="card-body"> <h3 class="card-title">'. $service->headline.'</h3> <p class="card-text">'. $service->summary .'</p> <div class="card-action"> <a href="" title="'. $service->name .'" role="link" class="link">View service<span></span></a> </div> </div> </div> '; } } // Grey snippet text echo '</div> </div> </section> <div class="snip-2 light-grey"> <div class="container"> <div class="row text-center">'. $tag->get('grey') .'</div> </div> </div>'; } ?> I appreciate this is a long post but i'm trying to be clear as I appreciate everyone's time.
      Any insight into where I am going wrong is greatly appreciated.
      Liam



    • By gregory
      Hi guys. I need to create a field (link field) that allows me to select the internal pages to use as links. Do you have any suggestions? Thank you.
    • By fabjeck
      Hello everyone.
       
      The website I'm currently working on, contains a "news-section", where the user/punlisher is able to write articles. In most cases the publisher is gonna add a image to the article. But when he doesn't, a default wallpaper, should be displayed. Now: My problem is that I'm struggling to get the default img, which is in an image folder under templates.
      if($article->image) { $image = $article->image->width(1000); } else { $image = templates->images->get('default_wallpaper.png'); /* of course it doesn't work like this, but that's what I want to achieve */ } $preview = $image->width(400); $thumb = $preview->url; $img = $image->url; }  
    • By anttila
      Is it possible to get rid of these useless rel attributes? It's CKeditor's default. I don't understand why those are forced.
       

    • By dweeda
      I put a CSS file in the /templates/styles/ folder and try to link from a published file in the /templates/ folder:
          <link rel="stylesheet" type="text/css" href="./styles/NavUserHdr.css">
      Doesn't see the file.
      What am I doing wrong?
       
×
×
  • Create New...