Search the Community
Showing results for tags 'data'.
-
Hi, I'm trying to import some heavy data into Processwire, but I'm not sure what would be the best way to do it. Usually I use CSV to Pages plugin, but this time the data is too heavy(~40k rows with 10+ columns of excel sheet), thus this plugin can't help. I also tried Tasker plugin but I can't seem to go through the setup itself, it requires some template setup but I'm totally clueless about how to do it, so that plugin is not of any use either. I wanted to know from you guys how you do it and in future what would be the best way to migrate thousands of rows of data in to PW. Thanks.
-
As a web developer I always want to improve the search results of my websites in popular search engines. Because of that I find the topic of structured data very interesting and want to learn more about them. Recently I tried out a few of the ways how to provide more information to a website and want to share my solutions. Most of the structured data can be included directly in the markup or as JSON-LD at the end of your document (right before the closing body tag). I prefer the last one, because I don't like to have bloated HTML markup. Breadcrumbs Breadcrumbs are an alternative way to show the your page hierarchy inside search results, instead of showing just the plain URL. Just like the breadcrumbs on a website. Following the example, I ended up with this code: <?php if(strlen($page->parents()) > 0) { ?> <!-- Breadcrumbs --> <script type="application/ld+json"> { "@context": "http://schema.org", "@type": "BreadcrumbList", "itemListElement": [ <?php $positionCounter = 1; $separator = ','; foreach($page->parents() as $parent) { if($parent->id == $page->parents()->last()->id) { $separator = ''; } echo ' { "@type": "ListItem", "position": "' . $positionCounter . '", "item": { "@id": "' . $parent->httpUrl . '", "name": "' . $parent->title . '" } }' . $separator . ' '; $positionCounter++; } ?> ] } </script> <?php } ?> First I am checking if the page has parents, then I follow the follow the markup of the example. I save the position of each parent in the variable positionCounter and increase its amount after each loop. As a last step I tried to end the JSON objects by not include the separating comma after the last object. This is why I am using the separator variable. Site name and sitelinks searchbox Using JSON-LD you can provide an alternative site name and a sitelinks searchbox inside the search results (Inception ). <!-- WebSite --> <script type="application/ld+json"> { "@context": "http://schema.org", "@type": "WebSite", "name" : "Your site name", "alternateName" : "Your alternative site name", "url": "<?= $pages->get(1)->httpUrl ?>", "potentialAction": { "@type": "SearchAction", "target": "<?= $pages->get(1)->httpUrl ?>search/?q={search_term_string}", "query-input": "required name=search_term_string" } } </script> I am not 100% sure, if the sitelinks searchbox works this way. Maybe someone who made this work before could confirm it, that would help me out. Organization For organizations you could provide a logo and links to your social profiles. <!-- Organization --> <script type="application/ld+json"> { "@context": "http://schema.org", "@type" : "Organization", "name" : "Your organization name", "url" : "<?= $pages->get(1)->httpUrl ?>", "logo": "<?= $pages->get(1)->httpUrl ?>site/templates/images/logo.png", "sameAs" : [ "https://www.facebook.com/your-organization-url", "https://www.instagram.com/your-organization-url/" // All your social profiles ] } </script> This one I think is self explanatory. Article If you have an blog or a news site you could enhance your articles with structured data with an thumbnail and author. <?php if($page->template == "post") { ?> <!-- Article --> <script type="application/ld+json"> { "@context": "http://schema.org", "@type": "NewsArticle", "mainEntityOfPage": { "@type": "WebPage", "@id": "<?= $page->httpUrl ?>" }, "headline": "<?= $page->title ?>", "image": { "@type": "ImageObject", "url": "<?= $page->thumbnail->httpUrl ?>", // Image field in template "height": <?= $page->thumbnail->height ?>, "width": <?= $page->thumbnail->width ?> }, "datePublished": "<?= date('c', $page->created) ?>", "dateModified": "<?= date('c', $page->modified) ?>", "author": { "@type": "Person", "name": "<?= $page->createdUser->first_name . ' ' . $page->createdUser->last_name ?>" // Text fields added to core module ProcessProfile }, "publisher": { "@type": "Organization", "name": "Your organization name", "logo": { "@type": "ImageObject", "url": "<?= $pages->get(1)->httpUrl ?>site/templates/images/logo.png", "width": 244, // Width of your logo "height": 36 // Height of your logo } }, "description": "<?= $page->summary ?>" // Text field in template } </script> <?php } ?> Here I am enabling structured data for the template called post. I also have the text fields first_name and last_name added to the core module ProcessProfile, the image field thumbnail and the text field summary added to the template. Just a small note: I know you could use $config->httpHost instead of $pages->get(1)->httpUrl, but I found the second one more flexibel for changing environments where you have for example HTTPS enabled. Those are the structured data I have in use so far. I hope I haven't made a mistake, at least the testing tool doesn't complain. But if you find something, please let me know. I love how easy it is with ProcessWire to get all the information from various pages and use them in this context. As mentioned above, I am nowhere an expert with structured data, but maybe some of you would like to provide also some examples in this thread. Regards, Andreas
- 34 replies
-
- 13
-
- structured
- data
-
(and 2 more)
Tagged with:
-
I'm working on a site where I need to output data for a table. I looked at the Matrix plugin, but, I don't think it does exactly what I want...since my particular table is split into colspans i.e. Direct, Maternal, Carcass, and $Index An example of the table output is attached. I've pondered using 3 repeaters for the first column titled, EPD, Acc and %Rank. Each one of these repeaters would have the fields for CE, BW, WW, YW, MCE.... The last thing I want is to have to create a very long list of inputs vertically down the page for each field in the back-end for my client. Any PW gurus here, maybe help me out? If there is absolutely, no alternative to make input simple for my client, let me know if I have to buy ProFields. thanks mucho!
-
I am trying to create a sort of database system using ProcessWire. I don't want all the data to show up as pages on the website but instead pull it into pages. Similar to the Skyscrapers demo except in that one the data shows up as pages. The data I wish to store is information about types of moths. So family, sub-family, genus and species. Each of these has information associated with it. For example, species has name, images and distribution. This is another example of information about the species. Initially, I attempted to do this using nested repeaters. This appears to work but I feel there is a better and more elegant way. Additionally, this page says: So I then tried using pages with children, but this also didn't work well. I had to make every single page unpublished as I don't want them showing up in menus and other places. This means they all have strikethroughs in the admin tree which is very annoying. Is there a better way of handling this kind of data in ProcessWire or is this maybe not a suitable project for ProcessWire? I apologise if this is a silly question, but I could not find anything on this matter and am still new to ProcessWire.
-
Hello, I want to put some data in a table field, but if I put the label of the first table field, it gives an error: Item 'feature' set to TableRows is not an allowed type Here is my code: foreach ($fetchAll as $fetch => $feature) { $productid = $feature["id_product"]; $pages = wire("pages")->get("productid=$productid"); $pages->of(false); // ensure output formatting is off $pages->Specification->feature = ($feature['name']); $pages->Specification->value = ($feature['value']); $pages->save(); } I tried to give the label other names, but it still doesn't work. How can this be solved?
-
Hi Folks, I am currently building an angular app for creating and displaying polls/surveys: http://embed.plnkr.co/seQfprxQRvjg84bvi2Dy/ The data that needs to be stored in PW comes from JSON and looks like { "title": "My Survey", "questions": [ { "id": 1, "title": "First Question", "answers": [ { "id": 1, "title": "Answer 1" }, { "id": 2, "title": "Answer 2" } ] } ], "file": { "$ngfName": "long-beach-koh-payam.jpg", "$ngfOrigSize": 351901, "$ngfBlobUrl": "blob:http://localhost:8000/8b87de97-549a-4900-8579-71a0d87a9258" } } Now I need to decide how to best store that data with PW. I am also using Angular to build the forms where users can submit the poll from the JSON that is produced by the survey builder. So I would like to create 1 page per poll. The template holds title field, an image file field and one field that stores the data as JSON string. To me this seems an easier approach than having child pages for each question in the poll and again child pages for each answer to a question. Do you see any disadvantages that this approach might bring? And which field type should I use to store the JSON string, textarea?
-
Hi all! this is more of a general MYSQL Schema discussion but i noticed that PW does a pretty good job of handling flexible objects (pages) by creating a new table for each object property (field). I was wondering what other options there are out there for storing flexible but efficient objects in MYSQL. I noticed that Wordpress uses it's wp_postmeta table extensively for storing flexible schema. Also according to Facebooks engineering there's a simplified schema overview of it's TAO based system that uses MYSQL as it's underlying datastore for it's graph data. (https://www.facebook.com/notes/facebook-engineering/tao-the-power-of-the-graph/10151525983993920) So as i say i was just curious really as to different setups and indexing options anyone has used to be able to handle flexible objects within MYSQL.
-
I have a friend who uses Silverstripe, and he was telling me about the Data Objects and the ORM it uses, for things like "has many", "one to one", "one to many" relations etc. Maybe i'm not thinking about things correctly, but in the Processwire world, would a Page essentially be a data object? Just want to get my head around how to think about structuring a web application in Processwire. I'm familiar with traditional MVC (rails, code igniter) based structures. The API may already enable this kind of functionality, but i was wondering if not, would Processwire ever get an ORM? or can an ORM be bolted onto Processwire? If anyone could help me figure this out that'd be great. Thanks
-
Hello, I want to add a custom method to the user object and need to pass some data ( an array called $params) to the method when I call it. I will call the method like this $user->saveprofile($params); The method takes that data and saves it to a user profile page. Only I don't know how to pass that data to my custom method. This might be a silly question. Please forgive me, but I am fairly new to OOP and PW modules/hooks development. This is what I have so far (taken off examples from here): public function init() { // init() is called when the module is loaded. $this->addHook('User::saveprofile', $this, 'UserSaveProfile'); } public function UserSaveProfile($event) { //how to pass my $params array to this method // Get the user object $user = $event->object; // get user data - this is where I am stuck $userData = // condition and actions if($user->hasRole("frontend")) { //create and save user profile page $this->message("Userprofile page for user " . $user->name . "has been created"); } } I tried to find examples of how to do that but could not find anything related in the forum. Any help would be appreciated. Thank you.
-
Hello, I've created an enterprise management system with ProcessWire where employees login to system and perform various tasks, such as creating invoices, adding client information, creating/answering support tickets etc. Client is very much concerned about the data security and data alteration by unauthorized person. So I've been asked to make sure the system is very secure and there's no way to alter or leak the company information anyway. While I'm already doing the required validation & making sure the user is authorized by making them login into system, whatelse should I be consider to make the system more safer? Just wanted to have better understanding of ProcessWire's security mechanism & how to make it better. Thanks everyone.
-
Hi folks, Okay this is a bit of an odd one to explain so if you need to email please do at rich.g.cook(at)gmail.com and I'll happily pay a fee for any solutions if needed. I'm building a simple cart/checkout setup and on submission at the checkout the form action, on a static test, was submission.php and on this .php file it got the $_POST data from the form, parsed it using twig, and items and pushed it using swift mail to the seller and the buyer. This all works fine statically, but the issue is now it's on a CMS the $_POST data isn't getting saved across so upon submission all the fields (first name, address etc) are just returning blank. If I hard link the form submission to the templates folder to submission.php then it works but in the URL you have the weird .php whereas if I add it as a page and template in the CMS it drops the .php which is nicer but it doesn't seem to save any of the data this way. I know this is a bit confusing, but hopefully I've made some sense and you guys could help. Thanks, R
-
Hi there! The title may be a bit misleading, or at least it's how I tried to achieve something which may not be possible in that combination. But let's start from the beginning: I'm trying to create a football team & game manager with processwire. As someone who used Excel in all ways possible to manage every aspect of a football team (members, positions, games, etc.) and having used processwire for solely building websites in the past, I thought this has to work, too. And for the most part it does! Yet, I have a few things which may work even better and that's where I'm stuck. I currently manage: Team members (pages) Game positions (pages) Games (pages) In "games" I have something like "location", "opponent", etc. and I have created a repeater field which includes "team member" (selector from page "team members") and "game position" (selector from "game positions"). I am able to map a "position" to a "team member" for each game. That's fine & well, BUT: it would nice, to have those selector being somehow connected to each other in a way, that if I am selecting a team member and assign him to a position, that this position & member will be deleted from other repeater "selectors". This way I want to prevent a team member or game position to be used n-times in one game. It's just a usability thing, but a big one for me, since I may be not the person working with this in the future. Is this somehow possible? Thank you!
-
Hi Guys, I am absolutely loving Processwire but need some assistance in a custom build. I have created a repeater for an internal page. I need to pull the data using GET or some other way to display the first five repeated sets onto my home page for my featured items section. Is this possible? If so, any examples? Guidance? Your help is much appreciated!
-
Just today I relaunched http://barefigur.es/ It’s now powered by ProcessWire. A bit of history: I launched Bare Figures in January 2012. Originally it’s a site for visualizing Apple’s quarterly results. Charts are being rendered by Highcharts JS. In the first few months after the original release I did all manually (actually also creating the JSON file by hand). After that I used a bare-bones SQL database for inputting the data and a PHP script generated the JSON file to feed Highcharts. Now Bare Figures is powered by ProcessWire (and it feels just absolutely right, I love it). I created a module that generates the JSON files and now the site is, of course, also scalable, which means I can add more companies to the site (the first one besides Apple is Google). I plan to add many more in the future. What do you think?