-
Posts
12 -
Joined
-
Last visited
Olli's Achievements
Jr. Member (3/6)
2
Reputation
-
How to set text line/character limits in templates?
Olli replied to photoman355's topic in General Support
@mr-fan, I guess I'm doing something wrong here: $default_desc = wordLimiter(ripTags($page->body), 160)); I'm trying to output the body elements of several childpages. Something I'm missing here? I got all the other code in the page too, and it runs through, yet no output. -
How to set text line/character limits in templates?
Olli replied to photoman355's topic in General Support
@Soma Your code seems to do the work, but does have a little issue. If you use line break or have several paragraphs, it stacks the whole text into one big mess. I have a list in one of my news stories with names on each line. This way it messes up the content quite well :/ Any workarounds for this? -
I'm getting the news content as wished but now I'm in trouble with the word count. As the foreach spits out the full length of the body text, I would need to limit this to e.g. 200 characters. Any ideas how that would be made with processwire or do I have to use normal php functions to limit it. Alternatively, I could make 2 bodys, one where the intro text is and another for the full text, this is more work for the publisher tho...
-
Well that was it I also got lost in my several template files but that final echoing fixed my problem Now my next task is to sort them by date... we'll see if I need help with that too... Edit: ("limit=3, sort=-date") seems to do most of the magic, just need to get the date sort to show latest first. Edit: wrong syntax... ("limit=3, sort=-created") yey!
-
Hey I'm trying to output on my frontpage the latest news but I keep getting a output of "". The sitemap looks something like this: Homepage -news page (uses template "news") --news listed separately as children to "news page" This is the probably the closest I have gotten to the right answer. So get the pages with template "news", which is just one page, and get the children of it. Am I missing something here? <?php foreach ($pages->get('template=news')->children as $news) { ?> <h1><?php $news->title ?></h1> <?php } ?> I have some dull information in the backend so I am expecting some output. Any ideas?
-
MarkupSEO - The all-in-one SEO solution for ProcessWire.
Olli replied to Nico Knoll's topic in Modules/Plugins
I really like the ease of use of this module. I'm using it on a page which I'm working on and seems to be pretty good for google searches. But I have one issue... I would like to have the page I'm working on in google searches listed as this: Main site child page 1 child page 2 child page 3 child page 4 child page 5 child page 6 child page 7 child page 8 as only one google search listing. Right now I get every page separately in the google search, making it look little messy. This might not be due to this plugin but google settings but I'm not sure. Anybody knows what I should work on to get it working? -
Hey I really like this module and got it working quite well. There's only a few issues which I've encountered. Some mails are being sent directly and other need a wait time of maybe 30 minutes to be send to the email I've set in the settings. I've excluded my IP for the spam option yet it takes a long time for some messages to get through. Any idea what triggers this? In the /scf-messages/ I can still see all the messages right away after they have been accepted by the system. Could it still have something to do with the spam filter? edit: Tried another IP too, still waiting for the mail... edit 2: Last received mail took 2h to arrive edit 3: Now they seem to come straight away... weird...
-
I'm still having issues. To clarify what I'm trying to achieve: This is avaible for the item, group 1 and group 2. I'm trying to output all items with eg. selected "Grupp1" as a foreach loop. This code doesn't seem to work for that. $items = $pages->find("limit=10, Selector=Grupp1"); foreach ($items as $item) { echo $item->title; echo $item->body; } Also the way LostKobrakai suggested I should make the build, I think my own way is better as I'm trying to have a page for each item separately. So we would have a group and under it as children items. So I'm trying to get a piece of code that gets the items with the selected Selector. Something's just not going as supposed... Any ideas?
-
This is a great idea! So then I could use this: $items = $pages->find("limit=10, attribute=attribute1"); foreach ($items as $item) { echo $item->title; echo $item->body; } Now I just need to understand page fields. Could one possibility be to download a multiselect dropdown plugin and use that instead? I know it's not nearly the best solution but still...
-
Hey people. as I have started building my second PW project, I have come to a little problem with items. So this is the planned sitemap: Frontpage -Products - -category 1 - -category 2 - -category 3 - -category 4 -Branches - -Branch 1 - -Branch 2 - -Branch 3 - -Branch 4 The idea is the categories have the items in their representable categories. These same items should be also visible on the Branch pages, but not in the same order. As I am mostly familiar with ExpressionEngine, I would put the items in the right categories, but as a attribute add which Branch they should be a part in. I've been getting some ideas from this: https://processwire.com/talk/topic/3579-tutorial-approaches-to-categorising-site-content/ But I find quite complicated and not sure what to really do. Also at a sidenote, The items should probably be the same kinda Child items as the Skyscraper Demo (Architects), but I can only manage to make new subpages...
-
I edited my post 1 minute before you posted yours Wanze, but I'll give a in-depth explanation. A loop, or repeater are pages which are repeated according to template and content is according to what is set in the admin section. I simplified my case as if a result is found, I can implement it in a slightly more complex system. I got a Option field to template which gives the values "yes", "no" and "". I would need to find a way to filter the result in the loop. Lets say I just want the results with value "yes". Then the loop would just show the pages with the value "yes" in the option field. Another option would be to separate the pages in different child pages, but then again that makes working with it not-so-userfriendly. A filter to either loop throught all contents with "yes" or "no" in field value is what I'm looking for.
-
Hey I'm stuck with a issue how to filter repeater results depending on content. I have a few Option fields where you can select "yes", "no" or then leave it blank "". I got my loop working and I'm able to skip content that has not been set. Now I just need a filter for the loop. <? foreach($pages->get("/content/")->children as $c): ?> <div> <p> <?php if($c->titles) echo $c->titles; ?> </p> </div> <? endforeach;?> I was able to make a if-statement which checked if($c->Selector=="no"): but as it was in the loop, it kinda bugged out. Never got it working either outside the loop... One really hacky way I thought about was using CSS Classes to set classnames, and that way split what is shown and what is not. This is a really bad way as it still loads all the content for each Selector value. What I'm looking for is eg. a filter that every Selector with value "yes" will be looped, others dismissed. Any ideas how to work on with this?