Bridge between two cms [closed] - php

It's difficult to tell what is being asked here. This question is ambiguous, vague, incomplete, overly broad, or rhetorical and cannot be reasonably answered in its current form. For help clarifying this question so that it can be reopened, visit the help center.
Closed 11 years ago.
I want to code as a personnal project (i'm student) a bridge between two cms located in 2 differents servers and databases.
For example an e-commerce cms and an ERP : I want to synchronise only let's say the 'order' table.
But the table schema is not the same so I have to make a 'compatibility' script to update the right corresponding fields.
Let's say it's done and I can synchronise the 2 tables in both directions : I can add an order in the e-commerce table when a new order is written in the ERP table. And the same in the other direction.
But I need to execute my scripts to make this happen.
I can put the script in a cron job so it's executed at 18 pm, but I want the data to be synchronised in real time.
Which means when a new order is added in the ERP table, the e-commerce table on the other server is updated too. And the same thing in the other direction.
The only solution I found is to fire some events. When the ERP table is updated a script is launched and update the e-commerce table. When the e-commerce cms table is updated, a script is launched and update the ERP table.
But it needs two scripts : one in both sides... I want only a script in one of the side.
How can I achieve this ? Is there a way/ a process to sync them in real time, just by creating an application in one of both sides

Use the same database for the two CMS instances.
If you're not doing that (or using a semi-real-time database replication layer), then the only way to keep them in sync with low latency is event-based message passing like you describe in your post.
This does not have a zero latency - you don't have a transactional commit system, so there is a moment after one CMS does something and before the other sees it. Whether this will cause you issues depends on what your particular use case is.
Again, the right way to do this is to have two frontends sharing one backend.

There are lots of issues with what you're proposing that make it rather impractical. It appears that you want to syndicate content between two completely different CMS systems in REAL TIME. Each picking up an RSS from the other would handle the syndication (but you'd have to handle changes which were merely updates, so not just a case of inserting new content) however this isn't going to perform well in real time across servers.
The world is full of compromises, and I think you would have to first consider compromising on the requirement for "real time".....

If you are using two CMS written in different languages, then you could approach this by setting up a simple REST API for both CMS. So that when either CMS is updated a call is sent to the other CMS API with a request to update.
I'm not sure if you're using pre existing CMS or your rolling your own, but you should do a search for 'rest API in PHP'

Related

Advice needed for a small web application's architecture/implementation [closed]

It's difficult to tell what is being asked here. This question is ambiguous, vague, incomplete, overly broad, or rhetorical and cannot be reasonably answered in its current form. For help clarifying this question so that it can be reopened, visit the help center.
Closed 10 years ago.
I was asked to build a website where a company's employees (around 20) could login and fill in their working schedules for a present and past (if needed) month. Employees should ofcourse only be able to see their own schedules, but the manager should have the privilege to access every schedule.
I have little experience in web development therefore an advice is needed. I have already created a PHP/MySql login page. Now what? How do I go about it?
Just some architectural or implementational(if you will) guidance would be really appreciated.
I have built applications similar to this in PHP / Mysql and can say that it's a good platform for it, although something like Rails might be quicker to use and require less micromanaging. As Wisdom says, use a framework to cut out some of the grunt work and ensure you're adhering to good security practices.
A few things come to mind that you'll need.
Clarity about what your database structure will look like. Try to identify: a) all the pieces of information you'll need to store (A user's name? login info? "authority" level to see others' entries?), b) what tables they can go in. (Can "name" and "hours worked" go in the same table? If they are different levels of analysis, should they go in different tables? Are those two bits of information connected somehow? If so, how should I represent that connection?) Relational design is your friend, especially if you're building something that might get revised later. Take the time to understand what it's about.
A page (view) for each different "type" of activity, would be a good place to start. So have a "Let me see my schedule" page, with links to a "Let me add a time entry" page and a "Let me edit that time entry" page. My experience is that, striving to keep your "view" pages' code as small and easy-to-read as possible, pushes you to better plan your code structure.
ANY values that you insert into a query string, should be sanitized. So queries to search or select values should always have any PHP variables filtered through a "cleaning" structure:
$query = sprintf("SELECT * FROM table1 WHERE identifier = %s",
mysql_real_escape_string($id));
Rather than:
$query = "SELECT * FROM table1 WHERE identifier = ".$id
because any text which a user types into a search or insert field online, if it ends up in your query, could be executed as part of the query. A hacker could then use this to make your other security features useless.
I would recommend to select a framework like cakephp or symfony this way you can avoid some mistakes. if you want to create by your own
first decide the database architecture that will fullfill your need.
than try to make crud functionality for each table as php object.
I think this can make you get going
I was heavily involved in the design of our company's internal dashboard, where employees can log-in and view pertinent company metrics. We used CodeIgniter as our framework and it worked really well! It's a PHP framework that uses MySQL, which we already had both PHP and MySQL installed on our servers. There were already a few people in our company who had experience with it, as it has been around a few more years and is more established than the latest and greatest fad frameworks. It has worked beautifully because of its MVC approach to development. We have attached it to our home-cooked database using Grocery CRUD. It has plug-ins that handle user authentication, sessions, and security. We have been extremely productive with it and I highly recommend. Keep in mind, this framework is designed for developers that want to create something very customizable. That being said, it provides basic things you need but lets you handle the higher-level stuff yourself.
You will need to design your database to meet your real-world constraints.
With MySQL you can create a relational database that reflects users and their positions. We created an E-R Diagram first to help our company's executives visualize the constraints and how we could model our business via the database, so that they could be involved in the discussion during the design phase.

Dynamic Application per user... (PHP MySQL) [closed]

It's difficult to tell what is being asked here. This question is ambiguous, vague, incomplete, overly broad, or rhetorical and cannot be reasonably answered in its current form. For help clarifying this question so that it can be reopened, visit the help center.
Closed 11 years ago.
So, I'm building a form that my users can customize based on their needs, and then accept responses to it from THEIR clients. Think of it like a Google Docs Form (I can log in and make a form of any size, with lots of dynamic fields).
What is the typical way to create this - and are there PHP libraries that are good at doing this already? As of now, it's my plan to just think of every field they could ever want, and associate a boolean logic with that field for that user. In other words, let's say these are all of the possible fields that could be used:
Name
Phone
Email
City
State
Each of those can be turned "on" or "off" for any of my users, so that it is (or isn't) displayed and used for THEIR clients. This seems like a very work-intensive way to do things, and I'm wondering if it makes more sense to allow a completely dynamic form to be created by them. But then again, that sounds like a lot more work to me...
So the question - Is my logic sound, and a standard way that people would code this? Why/Why not? Are there any libraries available that I can customize into my WebApp to allow completely dynamic form creation?
Thanks all!
We've built this before as an internal project for our own purposes. Good thing too cause it was much more complex than we wanted. We went with a custom solution because at the time we did not see any options to do basically what you wanted: local storage and highly customizable. We may have found something close - I don't remember exactly - but the part of your question I will address is whether or not your logic is sound and not necessarily if there is an existing library.
I would strongly suggest you do NOT think of every field they could want. You will lock yourself into a structured package that would be horrible to maintain. Abstracting this is the only way to go.
We made it so each form is an entry in the forms table. Simple enough. Form name, client id, status (active / disabled), etc.
Each field is in a relational table keyed to the form id, of course. This entry stores the label, id, type (select, multi select, radio, text, textarea), required (bool), order, active or disabled, options (like tinymce enabled, etc), etc.
Then each field has a many to one relational table for the options, if applicable. For dropdowns, radio buttons, etc.
This is not terribly complex initially, but when you start improving things - or even wanting to separate things into pages - it becomes worse and worse.
Point is - abstract it. You will be much happier in the end.
You want something like this http://code.google.com/p/jquery-form-builder-plugin/ ? It's a JQuery Form Builder Plugin and is server-side technology independent.

Should I not use CakePHP or MVC for this app? [closed]

It's difficult to tell what is being asked here. This question is ambiguous, vague, incomplete, overly broad, or rhetorical and cannot be reasonably answered in its current form. For help clarifying this question so that it can be reopened, visit the help center.
Closed 11 years ago.
I have been working for a company for the past several months as a kind of general developer/IT guy. I wrote a web app for the company that is hosted locally. I used CakePHP and MySQL (because the application fit the Active Record scheme really well).
The new web app I am working in is going to be used to analyze monthly sales data. Essentially, we get a humongous dump of information every month that I need to analyze...
Every month we get a huge table of data that has every one of our clients info (their ID#, how many $$ they processed, how much we made off them, etc.). Call this RESIDUAL
We also get another table that basically has their ID, a "description" (basically the type of expense), and a value. Call this INTERCHANGE
I have a permanent table called REPS that has each Sales Rep ID, their name, etc.
In order to get useful information (like the client name), I delete and reupload another table that has info like their Name, State, Status (if they are active or closed), etc... monthly.
I decided to make a residuals table that records the month as a column and I just add to it each month.
My problem is that working with CakePHP is getting pretty difficult. Say I want to get a table that has columns for each month and rows for each Sales Rep. It starts to get really complicated because this is NOT an Active Record application and I am having to do all sorts of long complicated find statements.
Would you recommend changing to a different framework, language, or database? What changes in Database structure should I make? My Controller is INSANELY long, should I shift more work to the Models?
Any ideas?
Edit: I need to create a system where my not-as-technical boss can easily run whatever sorts of analyses she wants.
Edit #2: Thanks for the responses. Yes I know SQL queries pretty well, and I actually started off just doing my own thing, but then I restructured the DB and converted to Cake right after that.
That's an extremely open ended question, as such you won't get a perfect answer. I can only throw in my two cents that Cake is not tuned for a database heavy application. By that I mean anything that is not simply CRUD record inserting, retrieving, updating. The Cake DAL does not scale well to accommodate complex queries or mass-data insertion/updating/manipulation.
Having said that, there's still PHP in CakePHP. You can issue "manual" queries using the model's query method. You should create methods in a model that does the heavy data lifting; such code is business logic and does not belong in the controller. In the model use regular PHP and SQL code to process data.
If this is pretty much the only thing your app does, you may be happier without Cake and just some thin wrapper around your own database connection like PDO. That forgoes Cake's nice routing, forms and views though, so you have to decide what you prefer to spend time on.
Examine your options first. Do you know any other frameworks? Do you know how to setup a plane Jane PHP app with your own MVC? A lot of components in frameworks can be found independently and added to your own application (like Active Records, Dependency Injection, Auto Loading etc, etc)
If the framework you are currently using is making it hard for you to get things done, then you should consider getting rid of it. Using a framework should make things easier, not hard. And the thing about CakePHP is that it goes by the mantra 'Convention over Configuration'. While it's great for getting out a certain type of new application off the ground in no time flat, it's not suitable for everything.
Since I don't know much about your project, I can't really help you choose a framework. But from my past experience, Zend Frameowork and CodeIgniter have been the most flexible. ZF also offers a good CLI structure as well, in case you need heavy duty crons running all the time. That being said, use these only if you really need/want a framework.
Having really complex controllers isn't a good thing. This might indicate that your models aren't doing enough work and most of your transformation is happening in your controllers. Your models and your views should be doing the bigger part of the work. I usually aim for thin controllers and fat models.
Have you considered other frameworks?
Symfony (I use 1.4.*), for example, can use Propel as its ORM. Propel is really well designed and it makes use of a Query object that makes getting data from the database really easy. It also allows for custom SQL queries to be written should you need to resort to that.
To answer your question, even though you're asking specifically about Cake PHP it sounds like the "This is too much" argument; as in "Using such and such framework is too much for this project". In my case, I prefer to deploy every project using a framework an plugins that I carry with me and invest time in knowing really well. They save me time and I don't have to think about basic plumbing code in every project I start.
A framework provides a lot of tools (besides the ORM), like routing, validation, etc that come very handy in almost any project and not having them really can slow you down a lot.
I would recommend you have a look at other options if you feel CakePHP has become cumbersome as I am very certain using a framework is the right choice.
I have a good and a bad news for you. The good news is that you started very well with Active Record, and CakePHP. The bad news is that your DB structure is not quite OK.
Read a little about Database Normalization and learn how to normalize your DB and data.
The first problem I see is that you add a column for each month. You should really have 2 more different tables:
1 for months - this can hold months name, and some super aggregated data like the total amount of sales for that month for the whole company
1 that will be the pivot table between REPS and months - in this you'll hold rep's id, month_id and possibly some information related to the sales of that rep for that month.
In the end you will have a many-to-many relation between reps and months. ActiveRecord will be more than happy, the MVC also, and also the developers that will work with or after you because this is how it should be done :)

What knowledge is required to develop a website in php? [closed]

It's difficult to tell what is being asked here. This question is ambiguous, vague, incomplete, overly broad, or rhetorical and cannot be reasonably answered in its current form. For help clarifying this question so that it can be reopened, visit the help center.
Closed 11 years ago.
Are there any prerequisites I need to know before I build a website/web application in php?
Anything like ajax, jquery, jsp etc?
PHP is a server side technology, it means the server execute your PHP script and then send the result to the user's browser.
JSP is a concurrent technology based on Java. Your site will be in PHP or JSP, not both.
AJAX stands for "Asynchronous Javascript And XML", it is a way to obtains data from a server with reloading the whole page.
jQuery is a Javascript framework which greatly simplify a lot of common tasks in Javascript.
Javascript is a language which is usually used client side to modify the page or respond to user's action without reloading the page.
You can do a complete site using only PHP without problem. Javascript and everything related (jQuery, AJAX) will help you building a site with better user experience if you do it right.
You can add MySQL to the list, or any other database technology, to store data on the server.
It completely depends on what you want to do, if you want to create a simple blog php is the only thing required, however if you would like to add more features then I would recomend starting the blog and learning more functions as you go along.
There are hundreads of tutorials out there which you can read or watch (on youtube) that will get you started. Most of the other languages such as javascript are touched on as they can make the site easier to use or just look better.
If you want to create a blog or a forum then php is all you need but you may like to start learning other languages once you have a good understanding of php. I would also recomend, if you are new to creating websites, that you should begin by creating a simple site first following a tutorial and then either adapt it or create an entirely different site after you understand the concept of php5.
Like others have said, it depends on what website you're trying to build. You'll be able to get quite far with just PHP/MySQL but for advanced interactivity and dynamics I'd suggest looking into other technologies and combining these into your website along with the PHP.
However, just starting a project and then adding things as you learn is probably the best way. You'll surely get to a point where you want to add something you don't really know how to do, and a quick search will point you towards.. for example, jQuery. That's the point where you can start learning about another jQuery and try to implement whatever it was that you wanted to add to the website.
However, for basic dynamic websites, PHP will do a great job. It all depends on what you want to achieve.
I recommend you to learn PHP hand in hand with MySQL, because it's a common combination for database based web applications.
For MySQL, the most important operations are CRUD
What do you want to create? Just throw in some signal words like guestbook, etc., so we can tell you more about the needed tools.

Best solution for a database driven web application? [closed]

It's difficult to tell what is being asked here. This question is ambiguous, vague, incomplete, overly broad, or rhetorical and cannot be reasonably answered in its current form. For help clarifying this question so that it can be reopened, visit the help center.
Closed 12 years ago.
I have been planning out the development of a web application written in PHP using the CakePHP framework. This application will be heavily dependent on a SQL database. The primary intent of the application is to provide HTML forms for adding, managing, and removing data from this database. It will be a descent sized database (1-2 dozen tables) and there will be a good number of links between them. There may also be some reporting on the data (would like to export to Excel/CSV or similar).
So here is my question, does anyone know what solution would be best for this type of situation? If this application was developed fully in PHP/CakePHP it would take quite awhile to develop by a single person and require the input of a developer to add/remove/update the database structure/fields. However I can provide much more custom interface tailored for the needs of the application and it will be web based (accessible anywhere). But there are also solutions such as Filemaker Pro that can provide a similar solution. Does anyone have experience with such applications and solutions?
I develop web applications using CakePHP and MySQL Full time for my current employer, so I'll try to answer your questions from experience:
does anyone know what solution would be best for this type of situation?
Any PHP Framework is a great solution for your problem model. I prefer CakePHP because it allows me to rapidly deploy applications, and it favors convention over configuration.
If this application was developed fully in PHP/CakePHP it would take quite awhile to develop by a single person and require the input of a developer to add/remove/update the database structure/fields.
From what you're telling me, your application will be mainly a CRUD app. A CakePHP installation comes standard with the features you need for this. Even better, you can use the CakePHP Console to "Bake" your application. This will automagically generate all of your Models and Controllers, and all of the views you will need to add/update/delete records from the tables.
The only preparation you need to Bake the app will be:
Creating the Database
Naming all of your tables following conventions from the documentation.
Ensuring you have all of your foreign keys in the proper place, following naming conventions.
At this point the Bake Console will get to work building models, discovering relationships, and generating code for CRUD operations. That's right, you'll be 70-90% DONE (based on your current, vague specifications) with the functionality in about 10 minutes after building the database. From there you will need to flesh things out with your own designs, security, and functionality like reporting.
It really is easy.
Now that I've said all of that, you'll need to know a couple of things:
To properly optimize CakePHP configuration takes a bit of experience and/or magic. Getting your application up and running is a veritable piece of cake. Making it run well takes some effort to make sure you use best practices. Search for variations on "Optimize CakePHP" in google and review the blogs you find.
The Containable Behavior is a blessing and a curse. By all means, put it in your AppModel to make everything "Containable." But, try not to use containable to find data from deeply associated models. Cake will barf out a few hundred (or thousand) Select queries, and your app will start to crawl/fail.
You can try out the Agile Platform by OutSystems. You can model your web applications visually (including all database details, web pages, logic, ...) and then generate a standard .Net application using a SQL server database.
Once you define the database structure, you can drag&drop tables into the pages to automatically create CRUDs. This greatly simplifies the implementation of web pages that manipulate data. These " wizards" will also create all the pagination and column sorting (when you're listing data from a table), as well as the pop-up forms (with field input validations) needed for users to input data.
Last, but not least, if you make changes to the database structure, the platform will automatically update all pages and logic (like queries) that you are using, and will pin-point all the elements you need to manually change to ensure the app is consistent.
You can download the Agile Platform for free at http://www.outsystems.com/download/ and give it a try.
Cheers
Michel
PS: I work at OutSystems

Categories