Jump to content

ryanC

Members
  • Posts

    97
  • Joined

  • Last visited

Everything posted by ryanC

  1. Thanks for your help, PWaddict and Adrian. I am going over your examples and I guess I'm not seeing it yet. I have named the main repeater field "myrepeat" and the image field within it "myphoto". So going over your examples I have something like: <?php foreach($page->myrepeat as $image) { echo "<img src='$image->myphoto->first->url'>"; } ?> also this for the second example: foreach($page->myrepeat as $image) { foreach($image->myphoto as $image) { echo "<img src='$image->url'>"; } } foreach($page->myrepeat as $myphoto) { foreach($myphoto->myphoto as $image) { echo "<img src='$image->url'>"; } } Am I getting close?
  2. Thanks Adrian, I am able to get all the other images to show up, using the example from that link. Just not for the repeater field. How would I alter this code to echo an image in a repeater field? This is working code I already have for a separate field. <?php foreach($page->myrepeat as $image) { echo "<img src='$image->url'>"; } ?> I am not at the PHP level a lot of people here are at.
  3. Hi psy, when I check my images field it's set to 0, no limit. I don't know if there is more than one place to change this setting.
  4. Hi, I have just set up a basic repeater. It has a title field, a body field, and an image field. I can get the title and body to show up, but I don't know what code to use for an image. I have checked many threads about Repeater, but they are above my php ability level to make sense of. This is what I have so far: foreach($page->myrepeat as $myrepeat) { echo "<p>{$myrepeat->title}</p>"; echo "<p>{$myrepeat->body}</p> "; } So far so good... but how to get the image field to echo too? I copied some working code I was using for a different image field, and tried to use it here, but nothing: <?php foreach($page->myrepeat as $image) { echo "<img src='$image->url'>"; }?> I have given the image field its own unique name (myphoto) but I don't know how to work that in. All I did was add it to the code above, I'm sure it's not the proper syntax: <?php foreach($page->$myrepeat->myphoto as $image) { echo "<img src='$image->url'>"; }?> Any ideas on how to get this repeater image to show up? Thanks!
  5. Thanks szabesz, I just figured it out right as you posted. Under the "modules" menu there is a "refresh" button. I hit that and my modules showed up.
  6. Hi, I have backed up my site with the Site Profile Exporter module. I've done this twice and I'm not sure if it's behaving correctly. I have two modules that I am using, BodyClass and InputfieldAceExtended. When I install a fresh version of Processwire with my site profile, all the pages and templates and content is ported over as expected, but when I go to edit a page that uses the module, Processwire gives me a red warning box that says: When I look at my modules folder, it is already there, along with the other modules. So it was at least exported. But do I still need to install this module manually? Thanks. Edit--Under the modules menu there is a refresh button. That did it.
  7. Thanks for your help everyone! I have entered: $results = $sanitizer->entities($q); echo "Search results for $results"; in my template and everything is working perfectly.
  8. Thanks Adrian, how would I enter that into my text? I am not very good at PHP yet. echo "<h2>Found $matches->count page(s) matching your query:</h2>"; echo "selectorValue"; Obviously it's not just "echo selectorValue", but I don't know what to put in there.
  9. Hi, I've been working on a modified version of the default search template that comes with the "beginner" site profile. When someone searches a term, I would like to include the term the user searched for along with the results. For example, say someone searched the word "apples". Right now I have: if($matches->count) { // we found matches echo "<h2>Found $matches->count page(s) matching your query:</h2>"; // output navigation for them (see TIP below) echo "<ul class='nav'>"; Is there a way I can have their term echoed back to them along with results? Something like: Thanks!
  10. Looks like I found the answer here on the forums: So now my path has: <base href="<?= $config->urls->templates ?>" /> in the header section, and from there I can simply type "images/photo.jpg" in my field.
  11. Hi, I’m building a simple Processwire test site. I am coding the pages with traditional HTML and CSS on my desktop, and then entering my HTML content into Processwire fields as a last step. The idea is to have a functioning static desktop version that works independent of any CMS. My php knowledge is very limited right now, but I am trying to learn. I have my Processwire templates and fields set up just the way I want, my question is regarding the path I have for my images. Right now, in Processwire, the field I enter my HTML content has this as an image path: <img src=“/siteName/site/templates/images/photograph.jpg" /> That works, but I would like it to be: img src="images/photograph.jpg"/> This way I could still have a functioning page independent of Processwire. Is this possible? Can I tell Processwire to ignore all those other levels of folders and just accept "images/photo"? Thanks!
  12. Thanks abdus--went back and set it back to array. I suppose limiting it would be more helpful if I was trying to limit what another user could upload to the site. I will look into tags, seems useful. And it's a good idea to not have multiple copies of the same image, so yeah a more generic name will make the pics multi-purpose, I can just resize the pic in the search results code.
  13. Thanks abdus! That really helped me out. Originally I did not change the maximum files allowed, it was at the default 0. But since I only want one image for this field, I decided to change the limit to 1, and simplified the code to: Nice and simple.
  14. Hi, on my test site I have created a field that holds an image. I have called the field "result_pic". I want that image to show up on my search results page. I have looked over this page: https://processwire.com/api/fieldtypes/images/ and some of it makes sense but it's taking me a while to get these php concepts (no php background). Looking over the forum, I found this thread: https://processwire.com/talk/topic/15128-images-not-showing-in-search-results/ where the user had the same problem I was having of not seeing their image. One of the responses was: And this worked for me, the image showed up at a smaller size. So if I didn't learn anything else, I could just leave it at that. But my question is, how do I simplify this? Can I get the image to show up without resizing it, and without putting it in a special if statement? So far I am just typing out combinations, none of which are showing the image...just a series of broken image links. Can I just echo the picture in a simple way, like the $match->title, and $match->summary ? Thanks!
  15. Thanks for the links and CKEDitor info, Sam and szabesz! I will check out that link to see about tweaking the editor.
  16. Thanks Sam, the first way is probably how I will be using images for now. Thanks for the tip on where the field uploaded images go to, haven't gotten that far yet but I'm sure I will have images entered that way as well. I was able to fix the broken link by entering the path correctly, but the CKEditor itself rearranges the order of tags, deletes comments etc. For example if I had a comment like <!--note for later-->, the second I hit save that comment is deleted. Also had a "width=100px" to my image code, and it was deleted also. So I got rid of it, I don't really need it necessarily.
  17. I'm making progress on this. It's a lot simpler than I expected: But this only works when CKEDITOR is not active on the field. Ckeditor looks nice but it strips out empty tags, erases inline styles, rearranges the code and wraps it in p tags : Is there another WYSIWYG editor I can use that will not modify my code like that?
  18. Hi, I'm creating a very basic Processwire test site. My aim is to have the site be mainly HTML and CSS that I code on my desktop, then paste the HTML into certain fields of Processwire. I know very little PHP. This main template page is for different kinds of fruit. I have my own navigation menu, a link to my own stylesheets, and one div called "fruit-content" that is the container for the "fruit_content" field I have created in Processwire, where all my content is going. So far, it's working fine: The problem I am having is the images. I have created my own images folder. But when I type the path into the Processwire field I can't get them to show up. I've tried: <img src="<?php echo $config->urls->templates?>images/apples.jpg" alt="Photo of two apples." /> That works when I'm testing on my desktop, it's the same way I'm linking to my stylesheets. But Processwire field just gives me a broken link icon. Is there a way to create my own folder of images, and just type out a path that will make that image show up? Thanks!
  19. Hi, I have been looking at Processwire for a while, have tried out some of the sample installations. My background is hand-coding sites in HTML and CSS. All I know about PHP is to include headers and footers, etc. A couple years ago I adapted a static site into CMSMS, because I needed a search function. That worked well but it’s a lot of set up for things that I could now do easier by hand. I'm much more comfortable with my own pages, I don't always want an interface (even though PW's is put together very well). Now I’m needing search again--and Processwire looks like it’s better for hand coders. The issue is I would like to keep my sites the way I'm used to: external CSS link in the head, a folder named images where I manually type the image path. I really don't want to mess with non-html and css stuff unless absolutely necessary, and I don't want to add a bunch of php tags to my page. BUT I need to have a search function--so that's why I'm here. Can I keep this type of workflow in Processwire? For example here’s a basic site, the way I would put it together: Fruit-(home page) Apples-(sub page) Oranges-(sub page) search in navbar: oranges (search results page:) Click here to visit oranges page. … Page structure: <php include header> static html content <php include footer> —That is all I need. Is a CMS overkill for what I need, or would I be better off just learning how to write a PHP search myself? Thanks for any advice.
×
×
  • Create New...