wordpress plugin making friendly URLs and accessing variables - url-rewriting

I've been searching for a couple of days for a particular answer to my question. I have written a custom plugin for wordpress which we will be using on our site. It was easier to make this a custom plugin rather than trying to use or hack existing ones.
As an example, let's say we are selling cars. My plugin lets us create a new car, upload a photo and write reviews about that car. This is all done through my plugin.
I now need to integrate that to the existing site using friendly urls.
I'd like domain.com/cars/ford-focus/2234 as the url. that would look like index.php?pagename=cars&model=matched[1]&otherid=matched[2]
also domain.com/category/hatchback would be index.php?pagename=category&cat=matched[1]
Both those urls would call a function and I will display the records on the page.
I am really struggling as to whether I create a page called "cars" and have a [shortcode] or do I handle everything in my plugin and rewrite urls. I have tried all sorts and its just not working. I don't know if I fully understand the way it works!?
Also - I have tried the route of using custom post types etc, but for our needs it's not right.
Thanks for any help!!

Related

How to add search to my static laravel site?

I'm building my first ever website using laravel 5.2. Right now, I'm only serving static content with a few API requests for things like the current weather. I've never built a website before, but I'm running my own droplet at DO, so there's no shared hosting limitations.
How would I implement a search that allows users to search my site's content from the main screen? Currently there's no interaction on a DB, it's all just Blade/HTML. I want to avoid using Google Custom Search as there should be no ads, and I want to learn along the way.
Please advise.
It depend on the amount of static contents you have in your site. Maybe you could try implementing it the following way.
Create lookup of the views pages with the most relevant keywords
When user search for keyword which match to any of my relevant keywords, I would load the respective view page.
I would store the the lookup in json format. It would be similar to contents with multiple tags on them.
Here, creating json file is going to be tedious and needs to be done manually.

One-page AJAX-based WordPress site. How should I do it?

I am trying to create a one-page WordPress website, something like the ones you sometimes see in ThemeForest's WP section: the whole website is a long page that has everything in one place, from about us, to portfolio, to some blog posts, to contacts.
Placing all things on one page is not difficult. But when I started thinking about how to present individual posts and pages, I realised that I probably need a general way of getting posts' data via AJAX, and create new blocks with JS. How should I go about this? I suppose this was done before, but I struggle to find something this specific on Codex or a tutorial with best practices.
Any advice or link will be greatly appreciated.
You could use a plugin such as jQuery Easytabs, download it here, that has a built-in Ajax component.
I've found that the easiest way is to just get all content to load into the divs ahead of time, vs. trying to load all pages through Ajax. However, appending something like '?ajax/ajax' to the end of your urls through the Easytabs plugin is one option that I have successfully used in the past.
If you decide to use the easytabs functionality, there is ample documentation on the page that I linked to.

Should I build my own PyroCMS module...?

I'm using PyroStreams on my PyroCMS-based site, which is working great, but the front-end search functionality it offers is a bit too limiting for my needs.
My stream consists of over 20 fields. On each page of the site I want a simple keyword search box which will search on 3 of the fields in my stream. Currently I'm using the PyroStreams search form for this and it's working great.
But I also want an advanced search page which will build a form based on all 20 fields, pulling in data from the stream to build it, e.g. in my steam I have a field-type of Country and on my advanced search form I want to include a dropdown list containing all the countries found within that field-type.
What I'm asking is what is the best approach to doing this?
Should I build my own module, separate from the PyroStreams module to perform this, or is that a bit of a sledgehammer to crack a nut?
I'm a bit of a novice in this field so all help & advice is greatly appreciated.
Tony.
Just Grab sample module from here...https://github.com/pyrocms/sample and understand the folder and file structure.. Its quite easy to develop custom module in pyrocms.You just have to provide basic module detail in the detail.php to install the module. then create a new controller with the same name as module in controllers folder and same for the view and model. you can easily understand once you will go through the sample module..
url stucture will be like this
{{ url:site }}controller_name/method_name/paramate of method.
Hopefully this will help you..
This is a late answer, but PyroCMS now has a search module.
You can see the documentation to learn how to use it from a developers point of view here:
PyroCMS 2.2 Search Documentation

From drupal to web2py: taxonomy/tagging and comments?

I have some sites that I implemented using Drupal. However as cool as Drupal is I've never been satisfied with coding in it mostly because it's in PHP and I've wanted to work with python. I've flirted with Django but I just recently discovered web2py and it's definitely caught my eye. Seems like it may be a sweet spot between Drupal and Django. Although django-cms is also on my radar.
So now I'm wondering how to re-implement my sites with web2py. Specifically suppose I have a site about DVD players. So in Drupal I'd have a CCK type DVD player, with various attributes. I guess this would correspond to a web2py model. How would I implement something like Drupal's taxonomy which is like a tagging system in web2py? Is there a module/plugin/appliance for that? Or am I manually creating the model schema to handle tagging?
Secondly, how would you handle something like comments and/or reviews on posts? Again, is there a pre-built plugin for this or do I have roll my own?
For tagging, I don't think web2py has anything quite like the Drupal Taxonomy module, but there are some options. First, you could create your own many-to-many model to assign tags to items. Another simpler option is to use web2py's list:reference field type to de-normalize the many-to-many relationship (the end of that section in the book includes a tagging example).
For existing tagging solutions, you can also check out web2py's plugin_wiki, which includes a tag widget. You can get it from the download page, or pull the source code directly. Another option is Powerpack, which includes the Instant Press CMS, which includes tagging and categories functionality.
Also, both plugin_wiki and Powerpack include comment plugins.
Finally, you'll generally get more and quicker responses from knowledgeable web2py users on the web2py mailing list.

How to create my own form in joomla

I want to create my own form that are submitted and values of that form will be stored in joomla database. How can i used the Joomla connection code to interacte with the joomla database.
If you just want to get your work done, there are some components already avaiable in Joomla Extension's website to your form's needs. CkForms is a good one, you can create simple forms with it that are automatically saved in the database (supports upload of files too).
If you want to learn how to write extensions in Joomla, you should read Joomla Official Documentation website.
Extensions in Joomla are divided in "Components", "Modules" and "Plugins". More informations about these differences can be found here and here.
What you're trying to achieve sounds a "component" to me. Downloading the CkForms and reading it's source code should get you started to Joomla's way of writing components.
EDIT: Joomla has a huge API with a lot of features. It has a database module of it's own, with insert methods and such. Reading Joomla's API website before implementing your component it's a good idea to avoid "reinventing the wheel" and it's a good practice since those methods are extensively tested by all Joomla users.
The JForm class helps you build forms.
Documentation can be found here:
joomla CMS: http://docs.joomla.org/API16:JForm
joomla API: http://api.joomla.org/11.4/Joomla-Platform/Form/JForm.html
This class provides you with ready to use form elements and form loading and/or processing methods
This class includes validation methods, date picker control, color picker, etc.
Of course, as another mentioned above, if you are building a module, component, or application, you will need to learn how to to develop a module, component or application. Of these three, the module is the easiest to implement.
The application gives you much freedom b/c you are not constrained to the CMS paradigm, front and back end complexities. However, there is little documentation about how to develop applications with Joomla framework b/c joomla as a framework is relatively new
This tutorial gets you started understanding how to use JForm to create a form in Joomla: http://www.ostraining.com/blog/how-tos/development/getting-started-with-jform/
Or you could just create add a html module to any position and then write the form in html i.e.
<form method="post" action="mycreatedpage.php"> <input type="text"/> <input type="submit">
Now just create a page that handles the code by emailing or inserting into db. I havent tried it but i think it should work.
Looks like everyone already told you almost everything I know except for the component creator. Very easy to use, and it follows Joomla standards. Will get you up and running within minutes.
I have got good working experience with Joomla RSForm Pro. It has got options for
validation
user email/admin emails on submit
file uploads
and many more
Good tutorials too. Get started with http://www.rsjoomla.com/support/documentation/view-knowledgebase/21-rsform-pro.html
Good luck!
Create View.
Create Model.
Create Table.
Create Controller ( if Needed ).
Create Form xml file.
Go here for more information:
http://docs.joomla.org/Standard_form_field_types
Take a look at the Chronoforms extension - does more than you want.
You have two options:
Use an already built custom form extension
Create your own custom form extension (or outsource it)
Now if you only want to modify the user registration form, then you can do some PHP customization to accomplish your goal.
Making forms in Joomla can be done in a couple of ways.
If you just wanted a contact us, you can just create a page with a menu item for the User contact form. This gives you a page with a Members address and contact form. So all you would need to do was add the user as the company of the websites home address and email. But the form is very basic, name, title, textarea for message.
Next up from that you could just make a Custom HTML module add add a form to it in plain HTML like +Sean said above this, you would need to code in PHP your own form process script. You would not get error in form data checking unless you also wrote it.
Next you might rather look on the Joomla Extension Directory JED for one of the good extensions for 3 and 2.5 Joomla RSForms!Pro is good, and can do all we have needed. This lets you add fields one by one and move your form around. Then can auto generate or custom the html of the form.
You can easily create your own forms with Fabrik
Chronoforms are now a days a very popular solution for custom forms in joomla. Chornoforms support twitter bootstrap also. In simple 5 steps you can create a contact form with unlimited fields and also embed various function like DB save, Email, Thanks Message, Redirection on any page. There is events and events will have particular events.
Also possibility of extension of Normal joomla registeration. It will not extend the core registration but at the time of registration you can take various information from users.
I would use Chrono Forms, they work really well and are easy to use.
Download here
Here is a full tutorial on the new Chronoforms 5 to help you get started quickly and understand most of the features available.
CLICK HERE
You can use plugin to insert external php form in content. It is easy and you don't need to make plugin etc. Please use this.
I suggest you to use breezingforms: http://crosstec.de/en/extensions/joomla-forms-download.html
It's one of the best solutions for custom form creation in joomla.

Resources