Download full CodeIgniter for Rapid PHP Application Development Improve your PHP coding productivity with the free compact open source MVC CodeIgniter framework 1st Edition David Upton ebook all chapters
Download full CodeIgniter for Rapid PHP Application Development Improve your PHP coding productivity with the free compact open source MVC CodeIgniter framework 1st Edition David Upton ebook all chapters
com
OR CLICK BUTTON
DOWLOAD EBOOK
https://ebookname.com/product/multi-tier-application-programming-with-
php-1st-edition-david-wall/
ebookname.com
https://ebookname.com/product/building-php-applications-with-symfony-
cakephp-and-zend-framework-1st-edition-bartosz-porebski/
ebookname.com
https://ebookname.com/product/wood-fracture-characterization-first-
edition-marcelo-f-s-f-de-moura/
ebookname.com
Electrons in Solids Mesoscopics Photonics Quantum
Computing Correlations Topology Graduate Texts in
Condensed Matter 1st Edition Hendrik Bluhm
https://ebookname.com/product/electrons-in-solids-mesoscopics-
photonics-quantum-computing-correlations-topology-graduate-texts-in-
condensed-matter-1st-edition-hendrik-bluhm/
ebookname.com
https://ebookname.com/product/unimaginable-bodies-intellectual-
disability-performance-and-becomings-1st-edition-anna-catherine-
hickey-moody/
ebookname.com
https://ebookname.com/product/traumatic-brain-injury-part-ii-1st-
edition-jordan-grafman-and-andres-m-salazar-eds/
ebookname.com
https://ebookname.com/product/writing-and-reading-across-the-
curriculum-eleventh-edition-laurence-behrens/
ebookname.com
https://ebookname.com/product/a-psychoanalytic-perspective-on-reading-
literature-1st-edition-merav-roth/
ebookname.com
Women Work and Autoimmune Disease Keep Working Girlfriend
1st Edition Rosalind Joffe
https://ebookname.com/product/women-work-and-autoimmune-disease-keep-
working-girlfriend-1st-edition-rosalind-joffe/
ebookname.com
CodeIgniter for Rapid PHP
Application Development
David Upton
BIRMINGHAM - MUMBAI
CodeIgniter for Rapid PHP Application Development
Improve your PHP coding productivity with the free compact
open-source MVC CodeIgniter framework!
All rights reserved. No part of this book may be reproduced, stored in a retrieval
system, or transmitted in any form or by any means, without the prior written
permission of the publisher, except in the case of brief quotations embedded in
critical articles or reviews.
Every effort has been made in the preparation of this book to ensure the accuracy of
the information presented. However, the information contained in this book is sold
without warranty, either express or implied. Neither the author, Packt Publishing,
nor its dealers or distributors will be held liable for any damages caused or alleged to
be caused directly or indirectly by this book.
Packt Publishing has endeavored to provide trademark information about all the
companies and products mentioned in this book by the appropriate use of capitals.
However, Packt Publishing cannot guarantee the accuracy of this information.
ISBN 978-1-847191-74-8
www.packtpub.com
Reviewers Indexer
Rick Ellis Bhushan Pangoankar
Derek Allard
Proofreader
Development Editor Chris Smith
Douglas Peterson
Production Coordinator
Assistant Development Editor Shantanu Zagade
Nikhil Bangera
Cover Designer
Technical Editor Shantanu Zagade
Ajay S
Editorial Manager
Dipali Chittar
About the Author
I’d like to thank Rick Ellis for writing CI and for making it available,
free. This spirit of generosity with such valuable intellectual
property is what makes the Open Source movement a success, and
an example to the rest of us.
I’d also like to thank Rick, and Derek Allard, for undertaking a
technical review of the book and making many helpful suggestions.
Lastly, but not least, my thanks to Julia, John, and James for their
love, support, and patience.
About the Reviewers
Rick Ellis is the founder and CEO of EllisLab.com, the company that develops
CodeIgniter and several other widely used web applications. Rick Ellis has a diverse
background in media technology, having worked in creative and technical capacities
on interactive projects for Disney, to feature films for Oliver Stone, and almost every
kind of web-based project in-between.
[ ii ]
Table of Contents
My 'Display' Model 78
CI's Validation Class: Checking Data Easily 79
Set Up Validation 80
Set Up the Controller 81
Set Up the Forms 81
Summary 83
Chapter 6: Simplifying Sessions and Security 85
Starting to Design a Practical Site with CI 85
Moving Around the Site 86
Security/Sessions: Using Another CI Library Class 91
Turning Sessions into Security 94
Security 96
Summary 98
Chapter 7: CodeIgniter and Objects 99
Object-Oriented Programming 99
Working of the CI 'Super-Object' 100
Copying by Reference 103
Adding Your own Code to the CI 'Super-Object' 105
Problems with the CI 'Super-Object' 106
Summary 109
Chapter 8: Using CI to Test Code 111
Why Test, and What For? 111
CI's Error Handling Class 113
CI's Unit Test Class 115
When to Use Unit Tests 117
Example of a Unit Test 118
CI's Benchmarking Class 121
CI's Profiler Class 122
Testing with Mock Databases 123
Control and Timing 124
Summary 125
Chapter 9: Using CI to Communicate 127
Using the FTP Class to Test Remote Files 127
Machines Talking to Machines Again—XML-RPC 129
Getting the XML-RPC Server and Client in Touch with Each Other 131
Formatting XML-RPC Exchanges 132
Debugging 134
Issues with XML-RPC? 135
Talking to Humans for a Change: the Email Class 136
Summary 139
[ iii ]
Table of Contents
[ iv ]
Table of Contents
[]
Preface
This book sets out to explain some of the main features of CI. It doesn't cover them
all, or cover any of them in full detail. CI comes with an excellent on-line User Guide
that explains most things. This is downloaded with the CI files.
This book doesn't try to duplicate the User Guide. Instead it tries to make it easier for
you to pick up how the CI framework works, so you can decide whether it is right
for you, and start using it quickly.
In some places, this book goes beyond the User Guide, though, when it tries to
explain how CI works. (The User Guide is more practically oriented.) This means
that there are some fairly theoretical chapters in between the "here's how" pages. I've
found that it helps to understand what CI is doing under the hood; otherwise you
sometimes get puzzling error messages that aren't easy to resolve.
I've tried to use a 'real-world' example when showing sections of CI code. I want
to show that CI can be used to develop a serious website with a serious purpose.
I'm currently running several websites for clients, and I want a program that will
monitor them, test them in ways I specify, keep a database of what it has done, and
let me have reports when I want them.
The examples in this book don't show it in full detail, of course: but they do, I hope,
demonstrate that you can use CI to make pretty well any common coding simpler,
and some uncommon stuff as well.
This book steps you through the main features of CodeIgniter in a systematic way,
explaining them clearly with illustrative code examples.
Preface
Chapter 2 explains what happens when you install the site, and which files will be
created. It gives a detailed overview of the required software, and explains the basic
configuration of CodeIgniter.
Chapter 3 explains how MVC helps to organize a dynamic website. It goes further
to explain the process by which CodeIgniter analyzes an incoming Internet request
and decodes which part of your code will handle it. Then CodeIgniter syntax rules
and the different types of files or classes you can find—or write for yourself—on a
CodeIgniter site are explained. At the end of the chapter, some practical hints on site
design are given.
Chapter 4 looks at how you set up a database to work with CodeIgniter, and then
how you use the Active Record class to manipulate the database.
Chapter 5 covers various ways of building views, how to create HTML forms quickly,
and how to validate your forms using CodeIgniter's validation class.
Chapter 6 looks at one of the basic questions affecting any website i.e. session
management and security; we also explore CodeIgniter's session class.
Chapter 7 covers the way in which CodeIgniter uses objects, and the different ways in
which you can write and use your own objects.
Chapter 8 covers CodeIgniter classes to help with testing: Unit tests, Benchmarking,
the 'profiler' and ways in which CodeIgniter helps you to involve your database in
tests without scrambling live data.
Chapter 9 looks at using CodeIgniter's FTP class and email class to make
communication easier, and then we venture into Web 2.0 territory using XML-RPC.
Chapter 10 talks about CodeIgniter classes that help in overcoming problems arising
regularly when you are building a website, for example, the date helper, the text and
inflector helpers, the language class, and the table class.
Chapter 11 looks at several useful CodeIgniter functions and helpers: file helper,
download helper, file upload class, image manipulation class, and the ZIP class.
Chapter 12 covers exploring your config files, using diagnostic tools, and potential
differences between servers, along with some notes on security.
[]
Preface
Chapter 13 shows you how to generalize CRUD operations so that you can do them
with two classes: one for the controller, and one for the CRUD model.
Chapter 14 looks at some coding examples, bringing together a lot of the functions
that have been discussed bit by bit in the preceding chapters.
Chapter 15 looks at some of the resources available to you when you start to code
with CodeIgniter, such as the libraries for AJAX and JavaScript, authentication,
charting, and CRUD.
Conventions
In this book, you will find a number of styles of text that distinguish between
different kinds of information. Here are some examples of these styles, and an
explanation of their meaning.
There are three styles for code. Code words in text are shown as follows: "We can
include other contexts through the use of the include directive."
When we wish to draw your attention to a particular part of a code block, the
relevant lines or items will be made bold:
</head>
<body>
<h1 class='test'><?php echo $mytitle; ?> </h1>
<p class='test'><?php echo $mytext; ?> </p>
</body>
[]
Preface
New terms and important words are introduced in a bold-type font. Words that you
see on the screen, in menus or dialog boxes for example, appear in our text like this:
"clicking the Next button moves you to the next screen".
Reader Feedback
Feedback from our readers is always welcome. Let us know what you think about
this book, what you liked or may have disliked. Reader feedback is important for us
to develop titles that you really get the most out of.
If there is a book that you need and would like to see us publish, please send
us a note in the SUGGEST A TITLE form on www.packtpub.com or
email suggest@packtpub.com.
If there is a topic that you have expertise in and you are interested in either writing
or contributing to a book, see our author guide on www.packtpub.com/authors.
Customer Support
Now that you are the proud owner of a Packt book, we have a number of things to
help you to get the most from your purchase.
[]
Preface
Errata
Although we have taken every care to ensure the accuracy of our contents, mistakes
do happen. If you find a mistake in one of our books—maybe a mistake in text or
code—we would be grateful if you would report this to us. By doing this you can
save other readers from frustration, and help to improve subsequent versions of
this book. If you find any errata, report them by visiting http://www.packtpub.
com/support, selecting your book, clicking on the Submit Errata link, and entering
the details of your errata. Once your errata are verified, your submission will be
accepted and the errata added to the list of existing errata. The existing errata can be
viewed by selecting your title from http://www.packtpub.com/support.
Questions
You can contact us at questions@packtpub.com if you are having a problem with
some aspect of the book, and we will do our best to address it.
[]
Introduction to CodeIgniter
Most of us just want to write applications that work well, and to do it as simply and
easily as we can. This book is about CodeIgniter, a tool for making PHP easier to use.
If you need to produce results, if you think that the details and intricacies of coding
are for geeks, then you should look at CodeIgniter (CI to its friends).
CI is free, lightweight, and simple to install, and it really does make your life much
easier. Just read this chapter to find out how:
That's quite a big claim. You have already spent some time learning PHP, HTML,
CSS, a database, and several other acronyms' worth of geek speak. You need a basic,
but not necessarily an expert, knowledge of PHP to benefit from CI.
Introduction to CodeIgniter
Save Time
CI doesn't take long to learn, and it quickly pays for your effort in the time saved
later on. Let's look at a simple measure:
This is not just good for the lazy. The less you type, the fewer mistakes you make,
and the less time you spend debugging your code. The smaller your code is, the
faster it loads and less space it takes up.
Here are two examples (which are explained later on in this book, so don't worry
now about how they work!).
Imagine you are writing a database query. This is how you might write a function
within your PHP programme to query a MySQL database:
$connection = mysql_connect("localhost","fred","12345");
mysql_select_db("websites", $connection);
$result = mysql_query ("SELECT * FROM sites", $connection);
while ($row = mysql_fetch_array($result, MYSQL_NUM))
{
foreach ($row as $attribute)
print "{$attribute[1]} ";
}
Compare the character counts: 244 for the traditional syntax; 112 for CI.
[]
Chapter 1
Now let's imagine that you are writing a data entry form in HTML, and you want
a drop-down query box. Let's say this drop-down query box shows three options
and allows the user to select one of them. In HTML, a drop-down box can be created
like this:
<select name="type">
<option value="1">www.this.com</option>
<option value="2">www.that.com</option>
<option value="3" selected>www.theother.com</option>
</select>
CI's version is both shorter and, because it works from an array, more adapted to
PHP processing:
$urlarray = array(
'1' => 'www.this.com',
'2' => 'www.that.com',
'3' => 'www.theother.com',
);
Then, you decide to move the site to another URL. That means you have to go
painstakingly through your code, looking for each URL, and re-writing it, or else
none of your links will work.
[]
Introduction to CodeIgniter
CI also encourages you to put the URL of your site in a configuration file that the
rest of your site can access. CI's anchor function that we've used here automatically
refers to that configuration file. So, when you come to move your site, you only
need to change that one entry in the configuration file, and all your hyperlinks
update automatically.
$temp = '__TEMP_AMPERSANDS__';
$str = htmlspecialchars($str);
return $str;
}
[ 10 ]
Chapter 1
This is code that handles special characters like '&'; so that they don't cause confusion
while your form is being submitted. As you can see, there is some quite tricky regex
code in there.
Possibly you like typing out regexes. Some people like lying on beds of nails, some
like listening to ABBA; it's a free country. (Well, it is where I'm writing this.) But
if you don't like these things, you can let CI do them for you (the regexes, I mean,
not ABBA), and you needn't even be aware of the code that's working away in the
background for you, every time you write that one simple line of code:
echo form_input('username', 'johndoe');
CI does the rest. Working behind the scenes, for example, is a function that sorts out
MIME types for nearly hundred different types of attachment. So it knows that
your photo, photo1.jpg,��������������������������������������������������������
is an 'image/jpeg' MIME type. It remembers to generate
[ 11 ]
Introduction to CodeIgniter
boundary delimiters in the right places around your attachments. It takes care of
wrapping your text, and it allows you to easily mark out chunks of text you don't
want wrapped.
Run this, and you find a ZIP archive on your C drive containing one file. Your ZIP
filer reader will unzip it and produce the original data for you.
People who use your site won't know that you've produced this impressive result
so easily. They'll be impressed! Your site will save bandwidth. You did it in minutes
rather than hours.
At one level, a framework is just that: lots of chunks of code, stored in separate files,
which simplify the coding of repetitive operations.
[ 12 ]
Discovering Diverse Content Through
Random Scribd Documents
merchant is credibly informed, that there are great advantages to be
obtained by trading into foreign countries; he receives the report
with a design to use all proper methods to partake of the advantage;
as our Saviour illustrates it, when he compares the kingdom of
heaven unto a merchant man seeking goodly pearls; who, when he
had found one pearl of great price, went and sold all that he had,
and bought, Matt. xiii. 45. We have sufficient evidence to support
our faith, that there is forgiveness of sin, through the blood of
Christ; and that all spiritual blessings are treasured up in him, for the
heirs of salvation: in this respect faith does not contain a bare
speculative assent to the truth of this proposition; but it excites in us
an endeavour to obtain these blessings in that way which is
prescribed by him, who is the giver thereof.
2. Faith may be farther considered, as denoting an act of trust or
dependence on him, who is the object thereof. This is very distinct
from the former sense of the word: for though it supposes indeed an
assent of the understanding to some truth proposed; yet this truth is
of such a nature, as that it produces in us a resting or reliance on
one who is able, and has expressed a willingness to do us good; and
whose promise relating hereunto, is such, as we have ground to
depend on. This supposes in him, who is the subject thereof, a
sense of his own weakness or indigence, and in him that is the
object of it, a fitness to be the object of trust, for his attaining relief:
thus the sick man depends upon the skill and faithfulness of the
physician, and determines to look no farther for help, but relies on
his prescriptions, and uses the means that he appoints for the
restoring of his health; or, as when a person is assaulted by one who
threatens to ruin him, and is able to do it, as being an over-match
for him, he has recourse to, and depends on the assistance of one
that is able to secure and defend him, and thereby prevent the
danger that he feared. Thus Jehoshaphat, when his country was
invaded by a great multitude of foreign troops, being apprehensive
that he was not able to withstand them; he exercises this faith of
reliance on the divine power, when he says, We have no might
against this great company, that come against us; neither know we
what to do, but our eyes are upon thee, 2 Chron. xx. 12. And God is
very often, in scripture, represented as the object of trust: so the
church says, I will trust, and not be afraid; for the Lord Jehovah is
my strength; and elsewhere, he that walketh in darkness and hath
no light, Isa. xii. 2. that is, knows not which way to turn, is helpless
and destitute of all comfort, is encouraged to trust in the name of
the Lord, and stay upon his God, chap. l. 10. This is truly and
properly a divine faith, and accordingly an act of religious worship;
and is opposed to a trusting in man, and making flesh his arm, Jer.
xvii. 5. and it supposes a firm persuasion, that God is able to do all
that for us which we stand in need of; and that he has promised that
he will do us good, and that he will never fail nor forsake them that
repose their trust or confidence in him: with this view the soul relies
on his perfections, seeks to him for comfort, and lays the whole
stress of his hope of salvation on him, not doubting concerning the
event hereof, but concluding himself safe, if he can say, that the
eternal God is his refuge, and underneath are the everlasting arms,
Deut. xxxiii. 27. This leads us,
II. To consider the various kinds of faith, as mentioned in scripture.
Thus we read of a faith that was adapted to that extraordinary
dispensation of providence, in which God was pleased to confirm
some great and important truths by miracles; which is therefore
styled a faith of miracles. There is also a faith that has no reference
to a supernatural event, or confined to any particular age or state of
the church, in which miracles are expected, but is founded on the
gospel-revelation, which, how much soever it may resemble saving
faith, yet falls short of it; and there is a faith which is inseparably
connected with salvation.
1. Concerning the faith of miracles. This is what our Saviour intends,
when he tells his disciples, That if they had faith as a grain of
mustard-seed, they should say unto this mountain, Remove hence to
yonder place, and it should remove; and nothing should be
impossible unto them, Matt. xvii. 20. This is such a faith that many
had, who were not in a state of salvation; as is plain from what our
Saviour says, that many will say to him in that day, Lord, Lord, have
we not prophesied in thy name? and in thy name have cast out
devils? and in thy name have done many wonderful works? to whom
he will profess I never knew you; and his commanding them to
depart from him as having wrought iniquity, chap. vii. 22, 23. And
the apostle Paul supposes, that a person might have all faith, that is,
this kind of faith; so that he might remove mountains, 1 Cor. xiii. 2.
which is a proverbial expression, denoting, that extraordinary and
miraculous events might attend it; and yet, at the same time, be
destitute of charity, or love to God, and consequently without saving
grace; and so appear, in the end, to be nothing.
Some have questioned whether this faith of miracles was peculiar to
the gospel-dispensation, in the time of our Saviour and the apostles,
and so was not required in those who wrought miracles under the
Old Testament dispensation; though others suppose, that, from the
nature of the thing, it was always necessary that faith should be
exercised, when a miracle was wrought; though it is true, we have
little or no account of this faith, as exercised by those that wrought
miracles before our Saviour’s time; and therefore, we cannot so
peremptorily determine this matter; but according to the account we
have thereof in the New Testament, there were several things
necessary to, or included in this faith of miracles.
(1.) Some important article of revealed religion must be proposed to
be believed; and in order thereunto, an explicit appeal made to God,
in expectation of his immediate interposure in working a miracle for
that end: every thing that was the object of faith, was not, indeed,
to be proved true by a miracle, but only those things which could not
be sufficiently evinced without it, so as to beget a divine faith in
those who were the subjects of conviction. We never read that
miracles were wrought to convince the world that there was a God,
or a providence; or, to persuade men concerning the truth of those
things that might be sufficiently proved by rational arguments: but
when there could not be such a proof given without the finger of
God being rendered visible by a miracle wrought, then they
depended on such an instance of divine condescension; and the
people who were to receive conviction, were to expect such an
extraordinary event.
(2.) It was necessary that there should be a firm persuasion of the
truth of the doctrine, to be confirmed by a miracle in him that
wrought it, together with an explicit appeal to it for the conviction of
those whose faith was to be confirmed thereby: and sometimes we
read, that when miracles were to be wrought in favour of them, who
before had a sufficient proof that our Saviour was the Messiah, it
was necessary that they should have a strong persuasion concerning
this matter, and that he was able to work a miracle; otherwise they
had no ground to expect that the miracle should be wrought: in the
former instance we read of Christ’s disciples working miracles for the
conviction of the Jews, and exercising, at the same time, this faith of
miracles; and in the latter a general faith was demanded, that our
Saviour was the Messiah, before the miracle was wrought; in which
sense we are to understand his reply to the man who desired that
he would cast the Devil out of his son; If thou canst believe, all
things are possible to him that believeth, Mark ix. 23. q. d. Thou
hast had sufficient conviction that I am the Messiah, by other
miracles, and consequently hast no reason to doubt but that I can
cast the Devil out of thy son; therefore, if thou hast a strong
persuasion of the truth hereof, the thing that thou desirest shall be
granted: and elsewhere it is said, He did not many mighty works
because of their unbelief, Matt. xiii. 58.
(3.) How much soever a person might exercise this strong
persuasion, that a miracle should be wrought, which we generally
call a faith of miracles; yet I cannot think that this event always
ensued without exception. For sometimes God might refuse to work
a miracle, that he might hereby cast contempt on some vile persons,
who pretended to this faith of miracles; who, though they professed
their faith in Christ as the Messiah, yet their conversation
contradicted their profession, and therefore God would not put that
honour upon them so as to work a miracle at their desire; much less
are we to suppose, that he would work a miracle at any one’s
pleasure, if they were persuaded that he would do so. Again,
sometimes God might refuse to exert his divine power, in working a
miracle, in judgment, when persons had had sufficient means for
their conviction by other miracles, but believed not. And finally, when
the truth of the Christian religion had been sufficiently confirmed by
miracles, they were less common; and then we read nothing more of
that faith which took its denomination from thence.
2. There is another kind of faith, which has some things in common
with saving faith, and is sometimes mistaken for it, but is vastly
different from it. This, in some, is called an historical faith; and in
others, by reason of the short continuance thereof, a temporary
faith. An historical faith is that whereby persons are convinced of the
truth of what is revealed in the gospel, though this has very little
influence on their conversation: such have right notions of divine
things, but do not entertain a suitable regard to them; religion with
them is little more than a matter of speculation; they do not doubt
concerning any of the important doctrines of the gospel, but are able
and ready to defend them by proper arguments: nevertheless,
though, in words, they profess their faith in Christ, in works they
deny him: such as these the apostle intends when he says; Thou
believest that there is one God, thou dost well: the devils also
believe and tremble, James ii. 19. And he charges them with a vain
presumption, in that they expected to be justified hereby; whereas
their faith was without works, or those fruits which were necessary
to justify, or evince its sincerity; or to prove that it was such a grace
as accompanies salvation; and therefore he gives it no better a
character than that of a dead faith.
As for that which is called a temporary faith, this differs little from
the former, unless we consider it, as having a tendency, in some
measure, to excite the affections; and so far to regulate the
conversation, as that which is attended with a form of godliness,
which continues as long as this comports with, or is subservient to
their secular interest: but it is not such a faith as will enable them to
pass through fiery trials, or part with all things for Christ’s sake, or to
rejoice in him, as their portion, when they meet with little but
tribulation and persecution, in the world, for the sake of the gospel.
This will evidently discover the insincerity thereof; for it will wither
like a plant that is without a root: our Saviour speaks of it in the
parable, of the seed that fell upon stony places, where they had not
much earth, and forthwith they sprang up, because they had no
deepness of earth; and when the sun was up, they were scorched;
and because they had no root they withered away; which he
explains of him, who heareth the word, and anon with joy receiveth
it; yet hath he not root in himself, but endureth for a while; for when
tribulation or persecution ariseth, because of thy word, by and by he
is offended, Matt. xiii. 5, 6. compared with ver. 20, 21. This parable
had a particular relation to the Jews, who heard John the Baptist
gladly, rejoicing in his light for a season; and seemed to be
convinced, by his doctrine, concerning the Messiah, who was shortly
to appear; but when they apprehended that his kingdom, instead of
advancing them to great honours in the world, was like to expose
them to tribulations and persecutions they were offended in him;
and this is also applicable to all those who think themselves
something, and are thought so by others, as to the profession they
make of Christ and his gospel; but afterwards appear to be nothing,
deceiving their own souls. This leads us,
3. To consider faith as a grace that is inseparably connected with
salvation, which is called justifying faith, and also a saving grace, in
this answer, in which the nature thereof is explained; and what may
be farther said concerning it will be considered under the following
heads, which we proposed to insist on in the general method before
laid down; and therefore we shall proceed,
III. To speak concerning the various objects and acts of saving faith.
1. Concerning its objects. Every thing that is the object thereof, must
take its rise from God; for we are now speaking concerning a divine
faith; and inasmuch as saving faith supposes and includes in it an
assent to the truth of divine revelation, we are bound to believe
whatever God has revealed in his word; so that as all scripture is the
rule of faith, the matter thereof is the object of faith: and as
scripture contains an historical relation of things, these are the
objects of faith, and we are to yield an assent to what God reveals,
as being of infallible verity. As it is a rule of duty and obedience, we
are bound to believe so as to adore the sovereignty of God,
commanding to submit to his authority therein, as having a right to
give laws to our consciences, and acknowledge ourselves his
subjects and servants, under an indispensable obligation to yield the
obedience of faith to him: as it contains many great and precious
promises, these are the objects of faith, as we are to desire, hope
for, and depend on the faithfulness of God for the accomplishment of
them; and more particularly considering them as they are all, yea
and amen, in Christ to the glory of God. As for the threatnings which
relate to the wrath of God, due to sin, and warnings to fence the
soul against it, and induce us to abhor and hate it; these are objects
of faith, so far as that we must believe and tremble, and see the
need we stand in of grace, which we receive by faith to enable us to
improve them, that through the virtue of Christ’s righteousness we
may hope to escape his wrath; and by his strength be fortified
against the prevalency of corruption, that has proved destructive to
multitudes.
But the principal object of faith is God in Christ, our great Mediator:
[61]
thus our Saviour says, Ye believe in God, believe also in me, John
xiv. 1. This is sometimes styled coming to the Father by him; as it is
elsewhere said, No man cometh unto the Father but by me: or else,
coming to him as Mediator immediately, that in him we may obtain
whatever he has purchased for us, and thereby may have access to
God, as to our reconciled God and Father; and in so doing, obtain
eternal life, as he expresses it; He that cometh to me shall never
hunger; and he that believeth on me shall never thirst, chap. vi. 35.
Which leads us to consider,
2. Those particular acts of saving faith, in which we have to do with
Christ as Mediator, whereby we have access to God, through him:
there are several expressions in scripture, by which these acts of
saving faith are set forth, some of which are metaphorical; more
particularly it is called a looking to him; thus he is represented, by
the prophet, as saying, Look unto me, and be ye saved all the ends
of the earth, Isa. xlv. 22. Sometimes by coming to him, pursuant to
the invitation he gives, Come unto me all ye that labour, and are
heavy laden, and I will give you rest, Mat. xi. 25. which coming is
elsewhere explained, as in the scripture before-mentioned, by
believing in him, John vi. 35. And as we hope for refreshment and
comfort in so doing, it is set forth by that, metaphorical expression,
of coming to the waters and buying wine and milk without money
and without price, Isa. lv. 1. that is, receiving from him those
blessings which tend to satisfy and exhilirate the soul, which are
given to such as have nothing to offer for them; and sometimes it is
represented by flying to him; or, as the apostle expresses it, flying
for refuge to lay hold upon the hope set before us, Heb. vi. 18. as
alluding to that eminent type thereof, contained in the man-slayer’s
flying to the city of refuge, from the avenger of blood, and therein
finding protection and safety: this is a description more especially of
faith as justifying; in which respect it is elsewhere described, as a
putting on the Lord Jesus Christ, Rom. xiii. 14. or the glorious robe
of his righteousness, on which account we are said to be clothed
with the garments of salvation, and covered with the robe of
righteousness, Isa. lxi. 10. And when we are enabled to apprehend
our interest in him by faith, together with the blessings that are the
result hereof, we are said to rejoice in Christ Jesus. There are many
other expressions by which this grace is set forth in scripture; but
those acts thereof, which we shall more especially consider, are our
receiving Christ, giving up ourselves to him, and trusting in, or
relying on him.
(1.) Faith is that grace whereby we receive Christ. Thus it is said, as
many as received him, to them gave he power to become the sons
of God, even to them that believe on his name, John i. 12. This
contains in it the application of an overture made by him; not barely
of something that he has to bestow, which might contribute to our
happiness, but of himself. Christ has many things to bestow upon his
people; but he first gives himself; that is, he expresses a willingness
to be their Prince and Saviour, their Prophet, Priest, and King; that
being thus related, and adhering to him, they may be made
partakers of his benefits, which are the result thereof; and
accordingly the soul, by faith applies itself to him, and embraces the
overture. Hereupon he is said to be ours; and, as the consequence
thereof, we lay claim to those benefits which he has purchased for
us, as our Redeemer. Christ is considered as the first promised
blessing in the covenant of grace; and with him God freely gives his
people all things that they stand in need of, which respect their
everlasting salvation, Rom. viii. 32.
This supposes the person receiving him to be indigent and destitute
of every thing that may tend to make him happy, brought into the
greatest straits and difficulties, and standing in need of one who is
able to afford relief to him. He has heard in the gospel, that Christ is
able to supply his wants; and that he is willing to come and take up
his abode with him; accordingly the heart is open to embrace him,
esteeming him to be altogether lovely and desirable, beholding that
excellency and glory in his person, that renders him the object of his
delight, as he is said to be precious to them that believe, 1 Pet. ii. 7.
looking upon him as God-man Mediator, he concludes, that he is able
to save, to the uttermost, all that come unto God by him; and that
all the treasures of grace and glory are purchased by him, and given
into his hand to apply to those who have an interest in him: he
expects to find them all in Christ, as the result of his being made
partaker of him; and accordingly he adheres to him by this which is
called an appropriating act of faith; whereby he that was before
represented in the gospel, as the Saviour and Redeemer of his
people, the fountain of all they enjoy or hope for, and by whom they
have access to God, as their reconciled God and Father, is applied by
the soul, to itself, as the spring of all its present and future comfort
and happiness.[62]
(2.) Another act of faith is giving up ourselves to Christ. As, in the
covenant of grace, God says, I will be to them a God, and they shall
be to me a people, faith builds on this foundation; it first apprehends
that he is able and willing to do them good, and make them happy
in the enjoyment of himself; and with this encouragement the soul
receives him, as has been but now observed; and pursuant hereunto
devotes itself to him, as desiring to be amongst the number of his
faithful Servants and followers. God sanctifies or separates them to
himself as the objects of his discriminating grace and love; and they
desire, as the consequence hereof, to give up themselves to him.
Two things are supposed in this act of self-dedication.
1st, A firm persuasion and acknowledgment of his right to us; not
only as the possessor of all things, which he has an undoubted right
to as God, as the potter has a right to his clay, the Creator to the
work of his hands; but that he has a right to us by purchase, as
Mediator, in which respect faith, and in particular, that which we call
saving, of which we are now speaking, has more especially an eye to
him; Ye are not your own, says the apostle, for ye are bought with a
price, 1 Cor. vi. 20. and therefore this act of faith is an ascribing to
him that glory which he lays claim to by right of redemption: and as
God has constituted him heir of all things, more especially of those
who are called his peculiar treasure: so the believer gives up himself
to him. Before this, the matter in dispute was, who is Lord over us?
Whether we ought to be at our own disposal or his? Whether it be
expedient to serve divers lusts and pleasures, or be subject to him
as our supreme Lord and Lawgiver? But the soul is thoroughly
convinced, by the internal efficacious work of the Spirit, that our
great Mediator is made of God, both Lord and Christ; and that no
one has a right to stand in competition with him; and that we owe
not only what we can do, but even ourselves unto him; and as the
result hereof, devotes itself to him by faith.
2d, This also supposes that we are sensible of the many blessings
that he has in store for his people; and therefore we give up
ourselves to him in hope of his doing all that for us, and working all
that grace in us which is necessary to our salvation; but more of this
will be insisted on, when we consider him as the object of trust. All
that I shall add at present, under this head, is, that having this view
of the person of Christ, as one who demands obedience, love and
gratitude from us, we give up ourselves entirely, and without
reserve, to him: thus the apostle says, They first gave their own
selves to the Lord, 2 Cor. viii. 5. and exhorts the church to yield
themselves unto God, as those that were alive from the dead, Rom.
vi. 13. and, to present their bodies, that is, themselves, and not
barely the lower or meaner part of themselves, a living sacrifice,
holy and acceptable to God, which is their reasonable service, chap.
xii. 1. and as the result hereof, we say by faith, Lord, truly I am thy
servant, and desire to be so for ever; work in me what thou
requirest, and then command what thou pleasest: I am entirely at
thy disposal, do with me as seemeth good in thy sight; only let all
the dispensations of thy providence be instances of thy love, and
made subservient to my salvation.
This is represented as our solemn act and deed; whereby, with the
most mature deliberation, we make a surrender of ourselves to him:
the prophet speaks of it as though it were done by an instrument or
deed of conveyance; and our consent to be his, is represented by a
giving up our names to him; One shall say, I am the Lord’s, and
another shall call himself by the name of Jacob; and another shall
subscribe with his hand unto the Lord, and sirname himself by the
name of Israel, Isa. xliv. 5. This is done with the highest veneration,
as an act of religious worship, and with the greatest humility, as
being sensible that we give him nothing more than his own; that he
is not profited hereby, but the advantage redounds entirely to us.
We do it with judgment; as faith always supposes a conviction of the
judgment, it considers those relations which Christ stands in to his
people, and endeavours to behave itself in conformity thereunto: we
are desirous hereby to give up ourselves to him as a Prophet, to be
led and guided by him in the way of salvation; as a Priest, to give us
a right to eternal life, as the purchase of his blood; as an Advocate
to plead our cause; and as a King to give laws to us, and defend us
from the insults of our spiritual enemies, and advance us to those
honours which he has laid up for his faithful subjects. We give up
ourselves to him to worship him in all his ordinances, in hope of his
presence and blessing to attend them, in order to our spiritual and
eternal advantage; and we do all this without the least reserve or
desire to have any will separate from, or contrary to his.
(3.) Another act of faith consists in a fixed, unshaken trust and
reliance upon him. This, as was before observed, is a very common
and known acceptation of the word faith. As we depend on his
promise, as a God that cannot lie, and give up ourselves to him, as
one that has a right to us; so we trust him, as one whom we can
safely confide in, and lay the whole stress of our salvation upon. This
act of faith is more frequently insisted on in scripture than any other,
it being a main ingredient in all other graces that accompany
salvation; and there is nothing by which God is more glorified: it is
not one single perfection of the divine nature that is the object
thereof; but every thing which he has made known concerning
himself, as conducive to our blessedness; we trust him with all we
have, and for all that we want or hope for. This implies in it a sense
of our own insufficiency and nothingness, and of his all-sufficient
fulness. The former of these is what is sometimes styled a soul
emptying act of faith; it is that whereby we see ourselves to be
nothing, not only as we cannot be profitable to God, or lay him
under any obligations to us, as those who pretend to merit any good
at his hand, but as unable to perform any good action without his
assistance; in this respect it says, surely, in the Lord have I
righteousness and strength, Isa. xlv. 24. and there is nothing tends
more to humble and abase the soul before him than this.
And hereby we are led to another act, which more immediately
contains the formal nature of faith; in which it depends on the all-
sufficiency of God, and his faithfulness to supply our wants, and
bestow the blessings which he has promised: God the Father is the
object of this trust or dependence, as the divine All-sufficiency is
glorified, grace imparted, and the promises thereof fulfilled by him,
through a Mediator; and Christ is the object thereof, as the soul
apprehends him to be full of grace and truth; sees the infinite value
of his merit, and his ability to make good all the promises of the
covenant of grace, and thereby to render him completely blessed.
When we trust Christ with all we have, or hope for, this supposes
that there is something valuable which we either enjoy or expect;
and that we are in danger of losing it, unless it be maintained by
him, who has undertaken to keep his people by his power through
faith unto salvation, 1 Pet. i. 5. and to perfect what concerns them.
We have souls more valuable than the whole world, and we commit
the keeping of our souls to him in well-doing as unto a faithful
Creator, chap. iv. 19. and merciful Redeemer; being assured that
none shall be able to pluck them out of his hand, John x. 28. and we
also commit all the graces which he has wrought in us to him, to
maintain and carry on to perfection. And since we are assured, that
all the promises are in his hand, and that he has engaged to make
them good to us, we are encouraged to trust him for all that we
expect, namely, that he will conduct us safely and comfortably
through this world, and at last receive us to glory; and in so doing,
we have the highest satisfaction; or, as the apostle expresses it, We
know whom we have believed, or trusted, and are persuaded that
he is able to keep what we have committed unto him against that
day, 2 Tim. i. 12. or the day of his second coming, when grace shall
be consummate in glory.
These acts of faith are generally styled, by divines, direct; in which
we have more immediately to do with Christ, as our great Mediator,
or God the Father in him; and being, properly speaking, acts of
religious worship, the object thereof must be a divine person. But
there is another sense of the word faith; which, as it does not
contain in it any act of trust or dependence, as the former does, so it
has not God for its immediate object, as that has; and this is what
we call the reflex act of faith, or the soul’s being persuaded that it
believes; that those acts of faith which have God or Christ for their
object, are true and genuine. This every one cannot conclude at all
times, who is really enabled to put forth those direct acts of faith,
that we have been speaking of; and it is the result of self-
examination, accompanied with the testimony of the Holy Spirit to
his own work.
Some indeed have questioned the propriety of the expression, when
this is styled an act of faith; as supposing that nothing can be so
called, but what hath a divine person for its object: but we have
before considered that faith, in a sense different from that in which
we have now explained it, may be conversant about divine things;
therefore, as we may be said, by a direct act of faith, to trust in
Christ; we may be persuaded, by this reflex act, that we do so: and
this is more immediately necessary to assurance, together with that
joy and peace which we are said to have in believing. But this we
shall have occasion to insist on under a following answer.[63]
IV. We are now to consider this grace of faith as that which
accompanies salvation, upon which account it is called a saving
grace; and also, that it is wrought in the heart by the power of the
Spirit, and by the instrumentality of the word. We do not suppose
that every act of faith denominates a person to be in a state of
salvation; for there is a bare assent to the truth of divine revelation,
that may, in a proper sense, be styled faith; and there may be an
external dedication to God, a professed subjection to him, which falls
short of that faith which has been before described, as it does not
proceed from a renewed nature, or a principle of spiritual life
implanted in the soul. There may be a willingness and a desire to be
saved, when the heart is not purified by faith; a hearing the word
with gladness, rejoicing in the light that is imparted thereby, for a
season, and doing many things pursuant thereunto, in some, who
shall not be saved: but faith is often-times described as referring to
and ending in salvation; thus we are said to believe to the saving of
the soul, Heb. x. 39. and, to receive the end of our faith, even the
salvation of our souls, 1 Pet. i. 9. This consists, more especially, in
those acts of faith, that contain in them an entire subjection of all
the powers and faculties of the soul to Christ, arising from the views
which it has of his glory, and its experience of his almighty power,
which is not only the way to, but the first fruits of everlasting
salvation. This is such a receiving and resting on Christ for salvation,
as has been before described.
And this grace is farther said to be wrought in the heart of a sinner,
by the Spirit. We have before considered effectual calling, as a work
of divine power, and proved, that the Spirit is the author of it;[64] and
that they, who are effectually called, are enabled to accept of, and
embrace the grace offered in the gospel; from whence it is evident,
that faith is the fruit and consequence of our effectual calling; and
therefore it must be a work of the almighty power and grace of the
Holy Spirit. And, this it farther appears to be, from that account
which we have thereof in several scriptures: thus the apostle Peter,
describing those he writes to, as having obtained like precious faith,
through the righteousness of God and our Saviour Jesus Christ; and
also as having all things that pertain unto godliness, in which faith is
certainly included, he ascribes this to the divine power, 2 Pet. i. 1.
compared with the 3rd verse. And elsewhere we read of the
exceeding greatness of the power of God exerted in them that
believe, Eph. i. 19. And when the work of faith is carried on, or
fulfilled in the souls of those in whom it was begun, it is considered
as an effect of the same power, 2 Thess. i. 11. And, as all that grace,
which is the effect of divine power, is ascribed to the Holy Ghost,
when he is said hereby, as acting in subserviency to the Father and
Son, to demonstrate his Personal glory: so the work of faith, in this
respect, is represented as his work; upon which account he is called
the Spirit of faith, 2 Cor, iv. 13.
But that which we shall more particularly consider is, that this grace
of faith is wrought by the instrumentality of the word. We have
before observed, that the principle of grace, implanted in
regeneration, is the immediate effect of the divine power, without
the instrumentality of the word; but when the Spirit works faith, and
all other graces, which proceed from that principle, then he makes
use of the word: thus the apostle says, Faith cometh by hearing, and
hearing by the word of God, Rom. x. 17. As it is necessary, in order
to our seeing any object, that the eye be rightly disposed and fitted
for sight, and the object presented to it: so there are two things
necessary to faith, namely, the soul’s being changed, renewed,
quickened, and so prepared to act this grace; and the objects being
presented to it, about which it is to be conversant; which latter is
done by the word of God: so that the soul is first internally disposed
to receive what God is pleased to reveal relating to the way of
salvation by Jesus Christ before it believes; and this revelation is
contained in the gospel, which is adapted to the various acts of faith,
as before described.
1. As faith implies a coming to Christ, or receiving him; the word of
God reveals him to us as giving an invitation to sinners, encouraging
them thereunto; thus our Saviour says, If any man thirst, let him
come unto me, and drink, John vii. 37. And, as a farther inducement
to this, it sets forth the advantages that will attend it, to wit, that he
will not reject them, how unworthy soever they be; as, he says, Him
that cometh to me, I will in no wise cast out, John vi. 37. And there
are many other privileges which he will bestow on them, namely, the
blessings of both worlds, grace here, and glory hereafter, all which
contain the very sum and substance of the gospel.
2. If we consider faith as including in it a giving up ourselves to
Christ, to be intirely his; the word of God represents him as having
an undoubted right to all who do so, inasmuch as they are bought
with the price of his blood, given to him as his own, by the Father.
And as they devote themselves to him, to be his servants, it sets
before them the privileges which attend his service, as they are
delivered from the dominion of sin, and a servile fear and dread of
his wrath; lets them know the ease, pleasure, and delight that there
is in bearing his yoke, and the blessed consequences thereof, in that
as they have their fruit unto holiness, the end thereof shall be life
everlasting, Rom. vi. 22.
3. As faith looks to Christ for forgiveness of sin, in which respect it is
called justifying faith; so the word of God represents him to us, as
having made atonement for sin; as set forth to be a propitiation to
secure us from the guilt which we were liable to, and the
condemning sentence of the law; as bearing the curse, and, as the
consequence thereof, giving us a right to all the privileges of his
children. It also represents this forgiveness as full, free, and
irreversible; and the soul, by faith rejoices in its freedom from
condemnation, and that right and title to eternal life, which is
inseparably connected with it.
4. As faith includes in it a trusting or relying on Christ, the gospel
represents him as an all-sufficient Saviour, able to save to the
uttermost all that come unto God by him, Heb. vii. 25. and as faith
trusts him for the accomplishment of all the promises, it considers
him as having engaged to make them good, inasmuch as they are
yea and amen in him, unto the glory of God, 2 Cor. i. 20. And
therefore, he runs no risque, or is at no uncertainty as to this
matter; for Christ’s Mediatorial glory lies at stake. If there be the
least failure in the accomplishment of any promise; or any blessing
made over to his people in the covenant of grace, which shall not be
conferred upon them, he is content to bear the blame for ever: but
this is altogether impossible, since he that has undertaken to apply
the blessings promised, is faithful and true, as well as the Father
that gave them; and this affords them strong consolation, who are
fled for refuge, to lay hold on the hope set before them in the
gospel, Heb. vi. 18. Thus Christ is set forth; and agreeably to this
discovery made of him, faith takes up its rest in him, and therein
finds safety and peace.
V. We shall now consider faith as strong or weak, increasing or
declining, with the various marks and signs thereof. As habits of sin
are stronger or weaker, the same may be said concerning habits of
grace. It is one thing for them to be entirely lost; and another thing
to be in a declining state: their strength and vigour may be much
abated, and their energy frequently interrupted; nevertheless God
will maintain the principle of grace, as we shall endeavour to prove
under a following answer.[65] Grace is not always equally strong and
lively; the prophet supposes it to be a declining, when he says,
Revive thy work, O Lord, in the midst of the years, Heb. iii. 2. and
our Saviour’s advice to the church at Sardis, implies as much, when
he exhorts them to strengthen the things which remain, that are
ready to die, Rev. iii. 2. and when he bids the church at Ephesus to
remember from whence they were fallen, and repent and do their
first works, chap. ii. 5. Some are said, as Abraham, to be strong in
faith, giving glory to God, Rom. iv. 20. and others are reproved, as
our Saviour does his disciples, at some times, when he says, O ye of
little faith, Matt. vi. 30. As our natural constitution is not always
equally healthy and vigorous, nor our condition in the world equally
prosperous, the same may be said concerning the habits of grace;
sometimes they are strong, and then, as the apostle says concerning
his beloved Gaius, 3 John ver. 2. the soul prospereth, and we go
from strength to strength, Psal. lxxxiv. 7. from one degree of grace
to another; but, at other times, we are ready to faint in the day of
adversity, and our strength is small, Prov. xxiv. 10. This cannot but
be observed by all who are not strangers to themselves, or who take
notice of the various frame of spirit, which are visible in those whom
they converse with.
But if it be enquired; by what marks or evidences we may discern
the strength or weakness of faith? though this will more evidently
appear from what will be said under a following answer,[66] when we
are led to speak concerning the reason of the imperfection of
sanctification in believers; yet we shall not wholly pass it over in this
place; and therefore, it may be observed, that the strength or
weakness of faith, is to be judged of by that degree of esteem and
value which the soul has for Christ, and the steadiness, or
abatement of its dependence on him. The greater diffidence or
distrust we have of self, and the more we see of our own emptiness
and nothingness, the stronger is our faith; on the other hand, self-
confidence, or relying on our own strength is a certain sign of the
weakness thereof.
Again, strong faith is that which carries the soul through difficult
duties; as the apostle says, I can do all things through Christ which
strengtheneth me, Phil. iv. 13. Whereas weak faith is ready to sink
under the discouragements that it meets with; the former is
stedfast, unmoveable, always abounding in the work of the Lord, 1
Cor. xv. 58. the latter is like a reed shaken with the wind. Strong
faith, as it is said of Job, Job i. 21. blesses God when he strips him
of all earthly enjoyments, and rejoices that the soul is counted
worthy to suffer shame for his name, Acts v. 41. and this carries him
above those fears which have a tendency to deject and dishearten
him: He shall not be afraid of evil tidings, his heart is fixed, trusting
in the Lord, Psal. cxii. 7. Whereas, weak faith is borne down, with
discouragements; he finds it hard to hold on in the performance of
his duty, and sees mountains of difficulties in his way; whereby the
soul is ready to conclude, that he shall not be able to get safely to
his journey’s end. He does not rightly improve the consideration of
the almighty power of God, and his faithfulness to his promise, in
which he has engaged, that the righteous shall hold on his way; and
he that hath clean hands shall wax stronger and stronger, Job xvii.
9. And when we sustain losses and disappointments in the world, or
things go contrary to our expectation, then we are ready to say with
the Psalmist, Hath God forgotten to be gracious? hath he, in anger,
shut up his tender mercies? Psal. lxxvii. 9. and sometimes conclude,
that we have no interest in the love of God, because the
dispensations of his providence are afflictive, and fill us with great
uneasiness. In this case fear looks upon every adverse providence,
as it were, through a magnifying glass, and apprehends this to be
but the beginning of sorrows; for it cannot say with the prophet, I
will trust and not be afraid, chap. xii. 2. for in the Lord Jehovah is
everlasting strength, chap. xxvii. 4.
Moreover, the strength or weakness of faith may farther be
discerned by our enjoying, or being destitute of communion with
God; our conversing with him in ordinances, or being deprived of
this privilege. We may conclude our faith to be strong, when we can
say as the apostle does, Our conversation is in heaven, or we live
above: but when, on the other hand, we have too great an anxiety
or solicitude about earthly things, and an immoderate love to this
present world, this argues the weakness thereof. The difference
between these two may also be discerned, by the frame of our spirit
in prayer. When faith is strong, the soul has a great degree of
boldness or liberty of access to the throne of grace; a greater
measure of importunity and fervency, accompanied with an
expectation of the blessings prayed for, by a secret and powerful
intimation from the Spirit, as a Spirit of grace and supplication; from
whence it infers, that he that excites this grace will encourage it, as
he says not to the seed of Jacob, seek ye me in vain, chap. xlv. 19.
We might also add, in the last place, that strong faith may likewise
be discerned, when it is accompanied with an assurance of an
interest in Christ’s righteousness, and our right and title to eternal
life founded thereon, or that God will guide us by his counsel, and
afterwards receive us to glory, and a persuasion wrought in the soul
by the Spirit, that nothing shall separate us from his love: whereas
weak faith is attended with many doubts concerning our interest in
Christ; sometimes fearing that our former hope was no other than a
delusion, our present experiences not real, the ground we stand on
sinks under us; and we are ready to conclude, that we shall one day
fall by the hands of our spiritual enemies. When I speak of these
doubts and fears, as an instance of weak faith, I do not say that
they are ingredients in faith; for they are rather to be considered as
a burden and incumbrance that attends it, so that though there be
some good thing in us towards the Lord our God, or a small degree
of faith, like a grain of mustard seed, these doubts proceed from the
weakness thereof, as opposed to that which is strong, and would
denote the soul to be in a happy and flourishing condition; which
leads us,
VI. To speak concerning the use of faith in the whole conduct of our
lives; as every thing that we do in an acceptable manner, is said to
be done by it. It is one thing occasionally to put forth some acts of
faith, and another thing to live by faith; which, as it is the most
noble and excellent life, so nothing short of it can, properly
speaking, be called a good life, how much soever many are styled
good livers, who are wholly strangers to this grace. The apostle Paul
speaks of this way of living, and considers it as exemplified in
himself, when he says, The life which I now live in the flesh, I live by
the faith of the Son of God, Gal. ii. 20. He speaks of it as his
constant work, or that which ran through the whole business of life.
Whether we are engaged in civil or religious duties, they are all to be
performed by faith. Here we shall consider the life of faith;
1. As it discovers itself in all the common actions of life; in these we
act as men: but that faith, which is the principal ingredient in them,
and their chief ornament, denotes us to walk as Christians; and this
we are said to do,
(1.) When we receive every outward mercy, as the purchase of the
blood of Christ, as well as the gift of his grace; and consider it as a
blessing bestowed by a covenant-God, who, together with outward
things, is pleased to give himself to us; which infinitely enhances the
value of the blessing, and induces us to receive it with a
proportionable degree of thankfulness.
(2.) When we set loose from all the enjoyments of this world, not
taking up our rest in them, as though they were our portion or chief
good; and therefore, the esteem and value we have for them is very
much below that which we have for things divine and heavenly.
When we use them to the glory of God; and account the best
outward enjoyments nothing, if compared with Christ; as the apostle
says, I count all things but loss for the excellency of the knowledge
of Christ, and do count them but dung, that I may win Christ, Phil.
iii. 8. This act of faith will quiet our spirits under afflictions, and
induce us to submit to the disposing providence of God; when our
best outward enjoyments are removed, or we called to suffer the
loss of all things for Christ’s sake, or by his sovereign will.
(3.) When all the success which we hope for in our secular
employments, is considered as an instance of that care which Christ
takes of his people, in which he over-rules and orders all things for
his own glory, and their welfare; and therefore, we are persuaded
that he will cause whatever we take in hand, to prosper, provided he
sees that it is best for us; and if not, we are disposed to acquiesce in
his will. This is such an instance of faith as will put us upon doing
every thing in the name and to the glory of Christ, and fortify us
against any disappointment that may attend our expectation, in
every employment wherein we are engaged.
(4.) When outward blessings, instead of proving a snare and
temptation, to draw off our hearts from Christ, are a means to bring
us nearer to him, so that if our circumstances are easy and
comfortable in the world, and we have more frequent opportunities
offered to us, to engage in religious duties than others, we are
accordingly inclined to embrace them; and when every thing we
enjoy, as an instance of distinguishing favour from God, above what
many in the world do, excites in us a due sense of gratitude, and an
earnest desire and endeavour to use the world to his glory.
(5.) When adverse providences, which sometimes have a tendency
to drive the soul from Christ, and occasion repining thoughts, as
though the divine distributions were not equal, are made of use to
bring us nearer to him, so that whatever we lose in the creature, we
look for, and endeavour to find in him. And when, with a submissive
spirit, we can say, that he does all things well for us, as we hope and
trust that he will make even those things that run counter to our
secular interests, subservient to our eternal welfare; and as the
result hereof, endeavour to keep up a becoming frame of spirit, in
such a condition of life, as has in itself a tendency to cast down the
soul and fill it with great disquietude.
(6.) When we devote and consecrate all we have in the world to
God, considering, that as we are not our own but his; so all we have
is his; and when hereupon we are endowed with a public spirit,
desirous to approve ourselves blessings to mankind in general, to
the utmost of our power; and when we have done all, not only say
with David, Of thine own we have given thee, 1 Chron. xxix. 14. but
as our Saviour taught his disciples to say, We are unprofitable
servants.
(7.) The life of faith discovers itself in the government of our
affections, namely, as they are kept within due bounds, set upon
right objects, and rendered subservient to promote Christ’s glory and
interest. Hereby are we prevented from setting our affections
immoderately on things of this world, when faith shews us that there
are far better things to draw them forth, which deserve our highest
love: it also prevents our being worldly and carnal, as though we
were swallowed up with the things of sense, and had nothing else to
mind, and religion were only to be occasionally engaged in; or, as
though an holy, humble, self-denying frame of spirit were
inconsistent with worldly business. Faith suggests the contrary; puts
us upon making religion our great business, and engaging in secular
affairs, rather as a necessary avocation from it, than that which is
the chief end of living. It also puts us upon glorifying Christ in our
secular concerns, as we manage them in such a way as he ordains;
and hereby the soul is kept in a spiritual frame, while abiding with
God in the calling whereunto he is called. This we attribute more
especially to the grace of faith, not only as it is connected with, and
(as will be observed under our next head) excites other graces; but
as it has its eye constantly fixed on Christ as its object, and by this
steers its course, and takes an estimate of the valuableness and
importance of all the affairs of this life, by their subserviency to our
salvation, and the advancement of his glory therein.
2. Faith discovers itself in the performance of all religious duties, and
the exercise of all other graces therein. Thus we read of the prayer
of faith, whereby a soul hath access to God as a father, in the name
of Christ; firmly relies on the promises which are established in him,
and has a liberty to plead with him, and hope of acceptance in his
sight. Moreover, when we wait on God to hear what he has to impart
to us in his word, faith having experienced some degree of
communion with him already, and had some displays of his love,
puts the soul upon desiring more, as the Psalmist says, My soul
thirsteth for thee; my flesh longeth for thee, to see thy power and
thy glory, so as I have seen thee in the sanctuary, Psal. lxiii. 1, 2.
And whatever other ordinances of divine appointment, we are
engaged in, we are hereby encouraged to hope for his presence,
and draw nigh unto him herein, with a reverential fear and delight,
in him: and it puts us upon the exercise of those graces which are
necessary for the right performance of gospel worship in general.
These are not only joined with it, but may be said to be excited
thereby; so that faith is, as it were, the principal of all other graces.
Thus when the heart is drawn forth in love to Christ, it may be said,
that faith worketh by love, Gal. v. 6. and when this love is
accompanied with joy unspeakable and full of glory; this we have in
a way of believing, and that which tends to excite the grace of love,
is the view that faith takes of Christ’s mediatorial glory and
excellencies, and the obligations we are under to love him, from his
grace of love to us; and this is a strong motive, inducing us to
express our love to him, by universal obedience, which is called, the
obedience of faith, Rom. xvi. 26.
When we exercise the grace of repentance, and thereby hate and
turn from all sin, and are, in a peculiar manner, sensible, as we
ought to be, of the sin of unbelief; it is faith that gives us this sense
thereof, as it is best able to see its own defects. When we confess
sin, or humble ourselves before God for it, faith views it not only as
a violation of the divine law, but as an instance of the highest
ingratitude; and when we desire, in the exercise of repentance, to
forsake sin, faith makes us sensible of our own weakness, and puts
us upon a firm and stedfast dependence on Christ, to enable us
thereunto; and when, in the exercise of this grace, our consciences
are burdened with a sense of guilt and unbelief is ready to suggest,
that our sins are so heinously aggravated, that there is no room to
hope for pardoning mercy, faith relieves us against these despairing
thoughts, and encourages us to wait for the mercy of God, who will
abundantly pardon, Isa. lv. 7. and with whom there is forgiveness,
that he may be feared, Psal. cxxx. 4.
And when we use endeavours to mortify sin, this is to be done by a
fiducial view of Christ crucified; and when we encourage ourselves
to hope that the indictment brought against us for it, was nailed to
the cross of Christ; and that there is no condemnation to us, as
being in him, Rom. viii. 1. and that, as the apostle says, Our old man
is crucified with him, that the body of sin might be destroyed: that
henceforth we should no longer serve sin, chap. vi. 6. all this is to be
done by faith.
We might also observe, that the grace of patience is connected with,
and we excited, thereunto by faith. The apostle, Heb. vi. 12. joins
both these together, as supposing that faith affords a motive to
patience; and elsewhere we read, not only of what faith enables us
to do, but bear, in the account which we have, of the great things
which the Old Testament saints did, and suffered by this grace: and
therefore, whatever graces are exercised under the afflictions of this
present life; faith excites in us a resignation to the will of God, and
consider them as the chastisements of a merciful Father, and as
bringing forth the peaceful fruit of righteousness unto them that are
exercised thereby, chap. xii. 11. and we are encouraged to bear
them with such a composed frame of spirit that they seem light, and
not worthy to be compared with the glory that shall be revealed.
This, faith has constantly in view, setting one against the other;
whereby that which would otherwise be an hindrance to us in our
way, is improved, by us, to our spiritual advantage; and we enabled,
not only to go on safely, but comfortably, till we arrive at the full
fruition of what we now behold at a distance, and rejoice in the
fiducial expectation thereof: which leads us to the last thing
proposed to be considered, concerning faith, namely,
VII. How it is to be attained or increased, and what are the means
conducive thereunto. Though faith, in common with all other graces,
be wrought in us by the power of God, yet we are far from
asserting, that there is no duty incumbent on us, in the performing
whereof, we are to hope and wait for the divine blessing, upon
which all the success thereof depends. To deny this would give just
occasion to charge the doctrine of efficacious grace, as though it led
to security, or licentiousness; which many do without ground.
Though grace and duty are very distinct, yet they are not
inconsistent with each other; the former is God’s work, the latter our
act.
As for those duties which are required of us, considered as expecting
the divine grace and blessing to attend them; these are, a diligent
waiting on God in all his ordinances; looking into the state of our
souls, by impartial self-examination; calling to mind our past
miscarriages, and what matter of humiliation we have for them in
the sight of God, as also, our natural aversion and inability to do
what is good; our need of Christ’s righteousness, to take away the
guilt we have contracted, and of his strength, to subdue our
corruptions, and enable us to plead earnestly with him for these
privileges.
As for the unregenerate, they must pray and wait on him, for the
first grace, and say, with Ephraim, Turn thou me, and I shall be
turned, Jer. xxxi. 18. They must be earnest with him, that he would
bestow upon them the grace of faith; which is styled, his gift; that
he would remove every thing that is, at present, an obstacle, or
hindrance to this grace, all the prejudices which corrupt nature has
entertained against Christ, and the way of salvation by him; and that
he would shine into their souls, to give them the knowledge of his
glory in the face of Christ; reveal his arm, and incline them, by the
internal working of his power, to receive the grace which is held
forth in the gospel. These are duties incumbent on persons who are
not called effectually, being destitute of regenerating grace.
But, on the other hand, they who have ground to conclude that they
have experienced this grace, though, at present, they apprehend
that their faith is weak, and on the decline; they must be found
waiting on God, in his own way; and be importunate with him in
prayer for the revival of his work, that so they may recover their
former experiences; they must bless him for the privileges they once
enjoyed, and be humbled for their past backslidings, whereby they
have provoked him to withdraw from them, and say with the church,
I will go and return to my first husband; for then was it better with
me than now, Hos. ii. 7. and, as it says elsewhere, Take away all
iniquity, and receive us graciously; so will we render the calves of
our lips, chap. xiv. 2. They must lament the dishonour that they have
brought to God; and consider how, by this means, they have grieved
the Holy Spirit, wounded their own consciences, and made work for
a bitter repentance and humiliation before God. They must be
sensible, that it is the same hand which wrought grace in them at
first, that must now recover them from their fallen state, and, by
exciting the principle of grace implanted, bring them into a lively
frame; and when he has done this, they must still depend upon him
to maintain this frame of spirit, as considering that as the beginning
so the progress of grace, is owing to him who is the author and
finisher of faith; who worketh in us that which is pleasing in his
sight, and carries on his own work unto perfection.
Quest. LXXIV.
Our website is not just a platform for buying books, but a bridge
connecting readers to the timeless values of culture and wisdom. With
an elegant, user-friendly interface and an intelligent search system,
we are committed to providing a quick and convenient shopping
experience. Additionally, our special promotions and home delivery
services ensure that you save time and fully enjoy the joy of reading.
ebookname.com